+++ /dev/null
-#include "roast/xml/roast_xml/sax.hpp"
-
-using namespace std;
-using namespace roast;
-using namespace roast::roast_xml;
-
-
-class _test_sax_impl
-{
-private:
- ::std::string m_indent;
-public:
- void start_xml_declaration()
- {
- printf("=XML Declaration : start=\n" );
- m_indent += " ";
- }
-
- void end_xml_declaration()
- {
- printf("=XML Declaration : end=\n\n" );
- m_indent = m_indent.substr(2);
- }
-
- void attribute( const sized_ccharbuf &attr_name, const sized_ccharbuf &attr_value )
- {
- printf("%sattr: %s=\"%s\"\n",
- m_indent.c_str(),
- attr_name.to_string().c_str(),
- attr_value.to_string().c_str() );
- }
-
- void comment( const sized_ccharbuf &s )
- {
- printf("%scomment: \"%s\"\n",
- m_indent.c_str(),
- s.to_string().c_str() );
- }
-
- void text( const sized_ccharbuf &s )
- {
- printf("%stext: \"%s\"\n",
- m_indent.c_str(),
- s.to_string().c_str() );
- }
- void start_element( const sized_ccharbuf &s )
- {
- printf("%s<elem: \"%s\"\n", m_indent.c_str(), s.to_string().c_str() );
- m_indent += " ";
- }
- void end_element(){
- m_indent = m_indent.substr(2);
- printf(" %send of element.\n%s>\n", m_indent.c_str(), m_indent.c_str());
- }
- void end_element( const sized_ccharbuf &s ){
- m_indent = m_indent.substr(2);
- printf(" %s/%s end of element.\n%s>\n", m_indent.c_str(), s.to_string().c_str(), m_indent.c_str());
- }
-};
-
-
-class _speed_test_sax_impl
-{
-private:
- ::std::string m_indent;
-public:
- void start_xml_declaration(){}
- void end_xml_declaration(){}
- void attribute( const sized_ccharbuf &attr_name, const sized_ccharbuf &attr_value ){}
- void comment( const sized_ccharbuf &s ){}
- void text( const sized_ccharbuf &s ){}
- void start_element( const sized_ccharbuf &s ){}
- void end_element(){}
- void end_element( const sized_ccharbuf &s ){}
-};
-
-//typedef sax_impl_<_test_sax_impl> test_sax_impl;
-//typedef sax_impl_<_speed_test_sax_impl> speed_test_sax_impl;
-static sax_impl_<_test_sax_impl> test_sax_impl;
-static sax_impl_<_speed_test_sax_impl> speed_test_sax_impl;
+++ /dev/null
-#include "roast/xml/roast_xml/sax.hpp"
-#include "roast/xml/roast_xml/rxpath.hpp"
-#include "roast/xml/roast_xml/sax_generator.hpp"
-#include "roast_xml/sax_test.hpp"
-#include <stdio.h>
-#include <string>
-#include <vector>
-#include <map>
-#include <time.h>
-
-using namespace std;
-using namespace roast;
-using namespace roast::roast_xml;
-using namespace roast::roast_xml::rxpath;
-
-///////////////////////////////////////////////////////////
-
-#define BUF_SIZE (32*1024*1024) // 32MB
-
-int main()
-{
- try
- {
- FILE* fp = fopen("temp.xml","rb");
- char* work = new char [BUF_SIZE];
- memset(work,0,BUF_SIZE);
- fread(work,1,BUF_SIZE,fp);
-
- //////////////////////////////////////////////
-
- map<int,string> tl;
- int id;
-
- ::std::string s;
-
- printf("start:%d\n", clock());
- sax sx;
- sx.analyze((const char*)work, speed_test_sax_impl);
- printf("end:%d\n", clock());
- printf("lines:%d\n", speed_test_sax_impl.get_line());
-
- /*
- //printf(work);
- sax_parser saxpar;
- saxpar.analyze((const char*)work,
- rax
- / "hoge"
- / "hoge"
- / text2print() );
- /* saxpar.analyze((const char*)work,
- rax /"statuses"/"status"/
- text2int(id) &&
- ( el("user")/aster/text/user_append_functor(id,tl)
- || aster/text/status_append_functor(id,tl)
- )
- );*/
- //saxgen /"statuses"/"status"/ ( el("!user")/status_append_o || el("user")/user ) );
- //saxgen / el("statuses") / el("status") / ( );
- //printf("%s\n", s.c_str());
- }
- catch(::roast::lexical::rule::eoi_exception& e)
- {
- printf("Invalid XML Term\n");
- printf("lines:%d\n", speed_test_sax_impl.get_line());
- //printf("Error!!\n");
- }
- catch(::std::string& e)
- {
- printf("\n\n#############################################################################"
- "\n%s\n", e.c_str());
- printf("lines:%d\n", speed_test_sax_impl.get_line());
- //printf("Error!!\n");
- }
- /*catch(rax_parse_error& e)
- {
- printf("%s\n", e.c_str());
- //printf("Error!!\n");
- }*/
-
-
- return 0;
-}
+++ /dev/null
-#include "roast/tp/static_map.hpp"
-#include <stdio.h>
-#include <time.h>
-
-using namespace roast;
-using namespace roast::lexical;
-
-
-int main()
-{
- //static_map<int, tuple< pair<1,10>, pair<2,20>, pair<3,40> > > sm;
- //printf("%d\n", sm::get<1>::value );
- using namespace std;
- static_map<const char*, 3> sm( make_ul_tuple( make_pair(1,"hoge"), make_pair(4,"huge"), make_pair(6,"hige") ) );
- printf("%s\n", sm.get<4>() );
-
- map<int,const char*> mp;
- mp[1] = "hoge";
- mp[4] = "huge";
- mp[6] = "hige";
- printf("%s\n", mp[4] );
-
- //(long long)'hoge';
-
- return 0;
-}