--- /dev/null
+// Roast+ License
+/*
+ Fixed String (gcc workaround)
+*/
+#ifndef __SFJP_ROAST__lexical2__fixed_string_HPP__
+#define __SFJP_ROAST__lexical2__fixed_string_HPP__
+
+#include "roast/lexical2/fixed.hpp"
+
+#pragma warning(disable:4503)
+
+namespace roast
+{
+ namespace lexical
+ {
+ namespace rule
+ {
+ ///////////////////////////////////////////////////////////////////
+
+ template <unsigned int _StrLength=0>
+ class fixed_string_ : public lengthable
+ {
+ protected:
+ const char* m_str;
+ public:
+ static const int length = _StrLength;
+
+ //////////////////////////////////////////////////
+ //fixed_string_(const char* s) : m_str(s){} for gcc workaround
+
+ template <typename _It, typename _Param>
+ bool analyze(_It& it, _Param& param)
+ {
+ for(const char* p=m_str; *p!='\0'; p++, it++)
+ {
+ if ( *it != *p )
+ return false;
+ }
+ return true;
+ }
+
+ //----
+
+ template <typename _Strm, typename _Document>
+ bool generate(_Strm& strm, _Document& doc) const
+ {
+ strm << m_str;
+ return true;
+ }
+
+ const char* get() const { return m_str; }
+ const char* c_str() const { return m_str; }
+ operator const char*() const { return m_str; }
+ };
+
+#define ROAST_LEXICAL_FIXSTR(CLS,S) \
+ class CLS : public ::roast::lexical::rule::fixed_string_<sizeof(S)-1> \
+ { \
+ public: \
+ CLS(){ m_str = S; } \
+ };
+
+ typedef fixed_string_<> fixed_string;
+
+ struct c_str : fixed_string
+ {
+ c_str(){ m_str = 0/*NULL*/; }
+ c_str(const char* s){ m_str = s; }
+
+ void set(const char* s){ m_str = s; }
+ };
+ }
+#define ROAST_LEXICAL_FIXED_STRING(CLS,S) ROAST_LEXICAL_FIXSTR(CLS,S)
+#define ROAST_LEXICAL_FIXSTR2(NAME) ROAST_LEXICAL_FIXSTR(NAME,#NAME)
+#define ROAST_LEXICAL_FIXED_STRING2(NAME) ROAST_LEXICAL_FIXSTR(NAME,#NAME)
+
+ using rule::fixed_string;
+
+ ////////////////////////////////////////////////////////////////////////
+
+ // generate/analyze() Functions
+
+ // generate
+ template <typename _Strm, unsigned int _StrLength>
+ bool generate(_Strm& strm, const ::roast::lexical::rule::fixed_string_<_StrLength>& str)
+ {
+ strm << str.get();
+ return true;
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ }
+}
+
+#endif//__SFJP_ROAST__lexical2__fixed_string_HPP__