1 /*
2  * CFixedText.hh
3  *
4  * Copyright 2014-2018 D. Mitch Bailey  cvc at shuharisystem dot com
5  *
6  * This file is part of cvc.
7  *
8  * cvc is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * cvc is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with cvc.  If not, see <http://www.gnu.org/licenses/>.
20  *
21  * You can download cvc from https://github.com/d-m-bailey/cvc.git
22  */
23 
24 #ifndef CFIXEDTEXT_HH_
25 #define CFIXEDTEXT_HH_
26 
27 #include "Cvc.hh"
28 
29 #include "obstack.h"
30 
31 #define obstack_chunk_alloc xmalloc
32 #define obstack_chunk_free free
33 
34 class CFixedText {
35 private:
36 	struct obstack fixedTextObstack;
37 	int size = 0;
38 	text_t firstAddress;
39 public:
40 	CStringTextMap fixedTextToAddressMap;
41 	CFixedText();
42 	~CFixedText();
Size()43 	inline int Size() {return size;};
Entries()44 	inline int	Entries() {return fixedTextToAddressMap.size();};
45 	void Clear();
BlankTextAddress()46 	text_t BlankTextAddress() {return firstAddress;};
47 	text_t SetTextAddress(const text_t theText);
48 	text_t SetTextAddress(const string theType, CTextList* theNewTextList);
49 	text_t GetTextAddress(const text_t theText);
50 	text_t GetTextAddress(string theText);
51 	void Print();
52 	friend void DumpStatistics(unordered_map<string, text_t> & theMap, string theTitle);
53 };
54 
55 class CCdlText : public CFixedText {
56 
57 };
58 #endif /* CFIXEDTEXT_HH_ */
59