Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
expander.h
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(tm)
3** Copyright 2025 Electronic Arts Inc.
4**
5** This program is free software: you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation, either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19// ---------------------------------------------------------------------------
20// File: expander.h
21// Author: Matthew D. Campbell
22// Creation Date: 9/13/2002
23// Description: Key/value pair template expansion class
24// ---------------------------------------------------------------------------
25
26#ifndef __EXPANDER_H__
27#define __EXPANDER_H__
28
29#include <map>
30#include <hash_map>
31#include <string>
32
33typedef std::map<std::string, std::string> ExpansionMap;
34
36{
37 public:
38 Expander( const std::string& leftMarker, const std::string& rightMarker );
39
40 void addExpansion( const std::string& key, const std::string val );
41 void clear( void );
42
43 void expand( const std::string& input,
44 std::string& output,
45 bool stripUnknown = false );
46
47 protected:
49 std::string m_left;
50 std::string m_right;
51};
52
53#endif // __EXPANDER_H__
54
void expand(const std::string &input, std::string &output, bool stripUnknown=false)
Definition expander.cpp:44
std::string m_left
Definition expander.h:49
std::string m_right
Definition expander.h:50
ExpansionMap m_expansions
Definition expander.h:48
void clear(void)
Definition expander.cpp:39
Expander(const std::string &leftMarker, const std::string &rightMarker)
Definition expander.cpp:29
void addExpansion(const std::string &key, const std::string val)
Definition expander.cpp:34
std::map< std::string, std::string > ExpansionMap
Definition expander.h:33