summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/parse/parse_c/token.h
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/parse/parse_c/token.h')
-rw-r--r--bitbake/lib/bb/parse/parse_c/token.h96
1 files changed, 0 insertions, 96 deletions
diff --git a/bitbake/lib/bb/parse/parse_c/token.h b/bitbake/lib/bb/parse/parse_c/token.h
deleted file mode 100644
index c6242015b7..0000000000
--- a/bitbake/lib/bb/parse/parse_c/token.h
+++ /dev/null
@@ -1,96 +0,0 @@
1/*
2Copyright (C) 2005 Holger Hans Peter Freyther
3
4Permission is hereby granted, free of charge, to any person obtaining a copy
5of this software and associated documentation files (the "Software"), to deal
6in the Software without restriction, including without limitation the rights
7to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8copies of the Software, and to permit persons to whom the Software is
9furnished to do so, subject to the following conditions:
10
11The above copyright notice and this permission notice shall be included in all
12copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
17SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
20THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22*/
23
24#ifndef TOKEN_H
25#define TOKEN_H
26
27#include <ctype.h>
28#include <string.h>
29
30#define PURE_METHOD
31
32
33/**
34 * Special Value for End Of File Handling. We set it to
35 * 1001 so we can have up to 1000 Terminal Symbols on
36 * grammar. Currenlty we have around 20
37 */
38#define T_EOF 1001
39
40struct token_t {
41 const char* string()const PURE_METHOD;
42
43 static char* concatString(const char* l, const char* r);
44 void assignString(char* str);
45 void copyString(const char* str);
46
47 void release_this();
48
49private:
50 char *m_string;
51 size_t m_stringLen;
52};
53
54inline const char* token_t::string()const
55{
56 return m_string;
57}
58
59/*
60 * append str to the current string
61 */
62inline char* token_t::concatString(const char* l, const char* r)
63{
64 size_t cb = (l ? strlen (l) : 0) + strlen (r) + 1;
65 char *r_sz = new char[cb];
66 *r_sz = 0;
67
68 if (l)
69 strcat (r_sz, l);
70 strcat (r_sz, r);
71
72 return r_sz;
73}
74
75inline void token_t::assignString(char* str)
76{
77 m_string = str;
78 m_stringLen = str ? strlen(str) : 0;
79}
80
81inline void token_t::copyString(const char* str)
82{
83 if( str ) {
84 m_stringLen = strlen(str);
85 m_string = new char[m_stringLen+1];
86 strcpy(m_string, str);
87 }
88}
89
90inline void token_t::release_this()
91{
92 delete m_string;
93 m_string = 0;
94}
95
96#endif