summaryrefslogtreecommitdiffstats
path: root/vhdlparser/vhdlstring.h
diff options
context:
space:
mode:
Diffstat (limited to 'vhdlparser/vhdlstring.h')
-rw-r--r--vhdlparser/vhdlstring.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/vhdlparser/vhdlstring.h b/vhdlparser/vhdlstring.h
index fde6ce4..4c64440 100644
--- a/vhdlparser/vhdlstring.h
+++ b/vhdlparser/vhdlstring.h
@@ -9,6 +9,7 @@
/** @brief Minimal string class with std::string like behaviour that fulfills the JavaCC
* string requirements.
*/
+
class VhdlString
{
public:
@@ -93,6 +94,8 @@ class VhdlString
void clear() { free(m_str); init(); }
VhdlString &operator+=(char c) { char s[2]; s[0]=c; s[1]=0; return append(s); }
VhdlString &operator+=(const char *s) { return append(s); }
+ VhdlString &operator+=(VhdlString s) { return append(s); }
+ VhdlString operator+ (const char *s) { return append(s); }
private:
void init() { m_str=(char*)calloc(1,1); m_len=0; }
@@ -100,4 +103,9 @@ class VhdlString
int m_len;
};
+// declare it static otherwise we will get:
+// multiple definition of `operator+(char const*, VhdlString)'
+// as we are in an include file
+static VhdlString operator+ (const char *s, VhdlString v) { return VhdlString(s).append(v); }
+
#endif