Adding new stuff
This commit is contained in:
parent
1f2c9e448a
commit
44142239cd
40 changed files with 16241 additions and 11 deletions
54
vim-plugins/bundle/targets.vim/autoload/targets/state.vim
Normal file
54
vim-plugins/bundle/targets.vim/autoload/targets/state.vim
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
let s:invalid = 0
|
||||
let s:empty = 1
|
||||
let s:nonempty = 2
|
||||
|
||||
function! targets#state#new(state)
|
||||
return {
|
||||
\ 'state': a:state,
|
||||
\
|
||||
\ 'isInvalid': function('targets#state#isInvalid'),
|
||||
\ 'isEmpty': function('targets#state#isEmpty'),
|
||||
\ 'isNonempty': function('targets#state#isNonempty'),
|
||||
\ 'isValid': function('targets#state#isValid'),
|
||||
\ 'isInvalidOrEmpty': function('targets#state#isInvalidOrEmpty'),
|
||||
\ }
|
||||
endfunction
|
||||
|
||||
" constructors
|
||||
|
||||
function! targets#state#invalid()
|
||||
return targets#state#new(s:invalid)
|
||||
endfunction
|
||||
|
||||
function! targets#state#nonempty()
|
||||
return targets#state#new(s:nonempty)
|
||||
endfunction
|
||||
|
||||
function! targets#state#empty()
|
||||
return targets#state#new(s:empty)
|
||||
endfunction
|
||||
|
||||
" raw attributes
|
||||
|
||||
function! targets#state#isInvalid() dict
|
||||
return self.state == s:invalid
|
||||
endfunction
|
||||
|
||||
function! targets#state#isEmpty() dict
|
||||
return self.state == s:empty
|
||||
endfunction
|
||||
|
||||
function! targets#state#isNonempty() dict
|
||||
return self.state == s:nonempty
|
||||
endfunction
|
||||
|
||||
" derived attributes
|
||||
|
||||
" empty or nonempty
|
||||
function! targets#state#isValid() dict
|
||||
return self.state != s:invalid
|
||||
endfunction
|
||||
|
||||
function! targets#state#isInvalidOrEmpty() dict
|
||||
return self.state != s:nonempty
|
||||
endfunction
|
||||
Loading…
Add table
Add a link
Reference in a new issue