00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef BASIC_POLICY_HEADER // Begin the Header Guard to prevent multiple
00034 #define BASIC_POLICY_HEADER // inclusions.
00035
00036 #include <bitset>
00037 #include <string>
00038 #include <utility>
00039 #include <vector>
00040
00041
00042 namespace commandl
00043 {
00044
00057 class policy
00058 {
00059
00060
00061 public:
00062 policy
00063 (
00064 std::vector<std::string>,
00065 std::vector<std::string>,
00066 std::bitset<8>,
00067 std::pair<std::string, std::string>
00068 = std::make_pair(std::string("["), std::string("]")),
00069 std::pair<std::string, std::string>
00070 = std::make_pair(std::string("<"), std::string(">"))
00071 );
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082 policy();
00083
00084
00085
00086 public:
00087
00088 virtual std::vector<std::string> prefixes() const;
00089 virtual std::vector<std::string> assignments() const;
00090 virtual std::pair<std::string, std::string> optional_brackets() const;
00091 virtual std::pair<std::string, std::string> value_brackets() const;
00092
00093 virtual bool is_empty_valid_prefix() const;
00094 virtual bool is_empty_valid_assignment() const;
00095 virtual bool is_token_separator_assignment() const;
00096 virtual bool no_prefix_keep_going() const;
00097 virtual bool no_prefix_keep_element() const;
00098 virtual bool no_key_keep_going() const;
00099 virtual bool no_key_keep_element() const;
00100 virtual bool ignore_prefix_if_value_required() const;
00101
00102
00103
00104
00105 public:
00106
00107 virtual void add_prefix( const std::string& );
00108 virtual void add_assignment( const std::string& );
00109 virtual void set_optional_brackets
00110 (
00111 const std::pair<std::string, std::string>&
00112 );
00113 virtual void set_value_brackets
00114 (
00115 const std::pair<std::string, std::string>&
00116 );
00117 virtual void is_empty_valid_prefix( bool );
00118 virtual void is_empty_valid_assignment( bool );
00119 virtual void is_token_separator_assignment( bool );
00120 virtual void no_prefix_keep_going( bool );
00121 virtual void no_prefix_keep_element( bool );
00122 virtual void no_key_keep_going( bool );
00123 virtual void no_key_keep_element( bool );
00124 virtual void ignore_prefix_if_value_required( bool );
00125
00126
00127
00128 protected:
00129
00130
00131
00132 private:
00133
00134
00135
00136 protected:
00137
00148 std::vector<std::string>
00149 Prefixes;
00150
00155 std::vector<std::string>
00156 Assignments;
00157
00159 std::pair<std::string, std::string> Optional_Brackets;
00160
00162 std::pair<std::string, std::string> Value_Brackets;
00163
00165 bool
00166 Empty_Is_Prefix;
00167
00169 bool
00170 Empty_Is_Assignment;
00171
00173 bool
00174 Separator_Is_Assignment;
00175
00177 bool
00178 No_Prefix_Keep_Going;
00179
00181 bool
00182 No_Prefix_Keep_Element;
00183
00185 bool
00186 No_Key_Keep_Going;
00187
00189 bool
00190 No_Key_Keep_Element;
00191
00195 bool
00196 Ignore_Prefix;
00197
00198 };
00199
00200 }
00201
00202 #endif // End the Header Guard
00203