File: file_option.h

package info (click to toggle)
xstow 1.0.2-1
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 1,064 kB
  • ctags: 1,073
  • sloc: cpp: 7,264; sh: 1,216; makefile: 196; awk: 26
file content (65 lines) | stat: -rw-r--r-- 1,095 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
 * $Log: file_option.h,v $
 * Revision 1.3  2010/07/21 19:38:25  martin
 * gcc-4 Port
 *
 * Revision 1.2  2005/07/04 21:59:42  martin
 * added logging to all files
 *
 */
#ifndef file_option_h
#define file_option_h

#include "arg.h"

/* 
   This Options are located in an extra module
   cause they are depending on some CppDir functions.
*/

namespace Arg {

    struct EnumFile
    {
	  enum ETYPE {
	    FIRST__,
	    ANY,
	    DIR,
	    LINK,
	    REGULAR,
	    LINK_TO_DIR,
	    LINK_TO_REGULAR,
	    LAST__
	  };
    }; 

    typedef EnumRange<EnumFile> FILE;


  class FileOptionRule : public AnyStringRule
    {
    protected:
      FILE type;

    public:
      FileOptionRule( FILE type = FILE::ANY );

      bool match( const std::string &value ) const;
    };

  class FileOption : public StringOption
    {
    public:
      FileOption( FILE type = FILE::ANY );
      FileOption( const std::string &name, FILE type = FILE::ANY );      
    };

  class EmptyFileOption : public EmptyStringOption
    {
    public:
      EmptyFileOption( FILE type = FILE::ANY );

    };
}

#endif