diff options
author | Mike Buland <eichlan@xagasoft.com> | 2008-03-07 23:12:59 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2008-03-07 23:12:59 +0000 |
commit | 6c27b9b4024331558e6a719293f2b44a6ae77c28 (patch) | |
tree | 49fd613d57f6e47b0cf7d02363a64b5c73c8c067 /src | |
parent | 57bbb6651bfc10d9f2404164e3303c3376dfc62c (diff) | |
download | libbu++-6c27b9b4024331558e6a719293f2b44a6ae77c28.tar.gz libbu++-6c27b9b4024331558e6a719293f2b44a6ae77c28.tar.bz2 libbu++-6c27b9b4024331558e6a719293f2b44a6ae77c28.tar.xz libbu++-6c27b9b4024331558e6a719293f2b44a6ae77c28.zip |
Minor updates to MiniMacro
Diffstat (limited to '')
-rw-r--r-- | src/minimacro.cpp | 15 | ||||
-rw-r--r-- | src/minimacro.h | 6 |
2 files changed, 18 insertions, 3 deletions
diff --git a/src/minimacro.cpp b/src/minimacro.cpp index 3e69fe4..c6a868f 100644 --- a/src/minimacro.cpp +++ b/src/minimacro.cpp | |||
@@ -14,6 +14,14 @@ Bu::MiniMacro::MiniMacro() | |||
14 | hFuncs.insert("tolower", new FuncToLower() ); | 14 | hFuncs.insert("tolower", new FuncToLower() ); |
15 | } | 15 | } |
16 | 16 | ||
17 | Bu::MiniMacro::MiniMacro( const StrHash &sVarSrc ) | ||
18 | { | ||
19 | for( StrHash::const_iterator i = sVarSrc.begin(); i != sVarSrc.end(); i++ ) | ||
20 | { | ||
21 | addVar( i.getKey(), i.getValue() ); | ||
22 | } | ||
23 | } | ||
24 | |||
17 | Bu::MiniMacro::~MiniMacro() | 25 | Bu::MiniMacro::~MiniMacro() |
18 | { | 26 | { |
19 | } | 27 | } |
@@ -163,11 +171,16 @@ bool Bu::MiniMacro::hasVar( const Bu::FString &sName ) | |||
163 | return hVars.has( sName ); | 171 | return hVars.has( sName ); |
164 | } | 172 | } |
165 | 173 | ||
166 | const Bu::FString &Bu::MiniMacro::getvar( const Bu::FString &sName ) | 174 | const Bu::FString &Bu::MiniMacro::getVar( const Bu::FString &sName ) |
167 | { | 175 | { |
168 | return hVars.get( sName ); | 176 | return hVars.get( sName ); |
169 | } | 177 | } |
170 | 178 | ||
179 | const Bu::StrHash &Bu::MiniMacro::getVars() | ||
180 | { | ||
181 | return hVars; | ||
182 | } | ||
183 | |||
171 | int Bu::MiniMacro::getPosition() | 184 | int Bu::MiniMacro::getPosition() |
172 | { | 185 | { |
173 | return iLastPos; | 186 | return iLastPos; |
diff --git a/src/minimacro.h b/src/minimacro.h index 7aed912..45a8555 100644 --- a/src/minimacro.h +++ b/src/minimacro.h | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | namespace Bu | 14 | namespace Bu |
15 | { | 15 | { |
16 | typedef Bu::Hash<Bu::FString, Bu::FString> StrHash; | ||
16 | /** | 17 | /** |
17 | * A processor for Libbu++ brand Mini Macros. These are really simple, but | 18 | * A processor for Libbu++ brand Mini Macros. These are really simple, but |
18 | * still fairly flexible. It's mainly text replacement, but with a few | 19 | * still fairly flexible. It's mainly text replacement, but with a few |
@@ -59,17 +60,18 @@ namespace Bu | |||
59 | {?name="bob":"You're named bob!":"Who are you? I only know bob..."} | 60 | {?name="bob":"You're named bob!":"Who are you? I only know bob..."} |
60 | @endverbatim | 61 | @endverbatim |
61 | */ | 62 | */ |
62 | typedef Bu::Hash<Bu::FString, Bu::FString> StrHash; | ||
63 | class MiniMacro | 63 | class MiniMacro |
64 | { | 64 | { |
65 | public: | 65 | public: |
66 | MiniMacro(); | 66 | MiniMacro(); |
67 | MiniMacro( const StrHash &sVarSrc ); | ||
67 | virtual ~MiniMacro(); | 68 | virtual ~MiniMacro(); |
68 | 69 | ||
69 | Bu::FString parse( const Bu::FString &sIn ); | 70 | Bu::FString parse( const Bu::FString &sIn ); |
70 | void addVar( const Bu::FString &sName, const Bu::FString &sValue ); | 71 | void addVar( const Bu::FString &sName, const Bu::FString &sValue ); |
71 | bool hasVar( const Bu::FString &sName ); | 72 | bool hasVar( const Bu::FString &sName ); |
72 | const Bu::FString &getvar( const Bu::FString &sName ); | 73 | const Bu::FString &getVar( const Bu::FString &sName ); |
74 | const StrHash &getVars(); | ||
73 | int getPosition(); | 75 | int getPosition(); |
74 | 76 | ||
75 | private: | 77 | private: |