Exemplo n.º 1
0
TEST(CSSTokenizerTest, Escapes)
{
    TEST_TOKENS("hel\\6Co", ident("hello"));
    TEST_TOKENS("\\26 B", ident("&B"));
    TEST_TOKENS("'hel\\6c o'", string("hello"));
    TEST_TOKENS("'spac\\65\r\ns'", string("spaces"));
    TEST_TOKENS("spac\\65\r\ns", ident("spaces"));
    TEST_TOKENS("spac\\65\n\rs", ident("space"), whitespace, ident("s"));
    TEST_TOKENS("sp\\61\tc\\65\fs", ident("spaces"));
    TEST_TOKENS("hel\\6c  o", ident("hell"), whitespace, ident("o"));
    TEST_TOKENS("test\\\n", ident("test"), delim('\\'), whitespace);
    TEST_TOKENS("eof\\", ident("eof"), delim('\\'));
    TEST_TOKENS("test\\D799", ident("test" + fromUChar32(0xD799)));
    TEST_TOKENS("\\E000", ident(fromUChar32(0xE000)));
    TEST_TOKENS("te\\s\\t", ident("test"));
    TEST_TOKENS("spaces\\ in\\\tident", ident("spaces in\tident"));
    TEST_TOKENS("\\.\\,\\:\\!", ident(".,:!"));
    TEST_TOKENS("\\\r", delim('\\'), whitespace);
    TEST_TOKENS("\\\f", delim('\\'), whitespace);
    TEST_TOKENS("\\\r\n", delim('\\'), whitespace);
    // FIXME: We don't correctly return replacement characters
    // String replacement = fromUChar32(0xFFFD);
    // TEST_TOKENS("null\\0", ident("null" + replacement));
    // TEST_TOKENS("null\\0000", ident("null" + replacement));
    // TEST_TOKENS("large\\110000", ident("large" + replacement));
    // TEST_TOKENS("surrogate\\D800", ident("surrogate" + replacement));
    // TEST_TOKENS("surrogate\\0DABC", ident("surrogate" + replacement));
    // TEST_TOKENS("\\00DFFFsurrogate", ident(replacement + "surrogate"));
    // FIXME: We don't correctly return supplementary plane characters
    // TEST_TOKENS("\\10fFfF", ident(fromUChar32(0x10ffff) + "0"));
    // TEST_TOKENS("\\10000000", ident(fromUChar32(0x100000) + "000"));
}
Exemplo n.º 2
0
void TableFormater::header()
{
	delim();
	for(unsigned int i=0;i<columnTitle.size();i++) *out << "| "<<std::setw(columnWidth[i])<<columnTitle[i]<<" ";
	*out<<"|"<<std::endl;
	delim();
}
TEST(CSSTokenizerTest, Escapes)
{
    TEST_TOKENS("hel\\6Co", ident("hello"));
    TEST_TOKENS("\\26 B", ident("&B"));
    TEST_TOKENS("'hel\\6c o'", string("hello"));
    TEST_TOKENS("'spac\\65\r\ns'", string("spaces"));
    TEST_TOKENS("spac\\65\r\ns", ident("spaces"));
    TEST_TOKENS("spac\\65\n\rs", ident("space"), whitespace(), ident("s"));
    TEST_TOKENS("sp\\61\tc\\65\fs", ident("spaces"));
    TEST_TOKENS("hel\\6c  o", ident("hell"), whitespace(), ident("o"));
    TEST_TOKENS("test\\\n", ident("test"), delim('\\'), whitespace());
    TEST_TOKENS("test\\D799", ident("test" + fromUChar32(0xD799)));
    TEST_TOKENS("\\E000", ident(fromUChar32(0xE000)));
    TEST_TOKENS("te\\s\\t", ident("test"));
    TEST_TOKENS("spaces\\ in\\\tident", ident("spaces in\tident"));
    TEST_TOKENS("\\.\\,\\:\\!", ident(".,:!"));
    TEST_TOKENS("\\\r", delim('\\'), whitespace());
    TEST_TOKENS("\\\f", delim('\\'), whitespace());
    TEST_TOKENS("\\\r\n", delim('\\'), whitespace());
    String replacement = fromUChar32(0xFFFD);
    TEST_TOKENS(String("null\\\0", 6), ident("null" + replacement));
    TEST_TOKENS(String("null\\\0\0", 7), ident("null" + replacement + replacement));
    TEST_TOKENS("null\\0", ident("null" + replacement));
    TEST_TOKENS("null\\0000", ident("null" + replacement));
    TEST_TOKENS("large\\110000", ident("large" + replacement));
    TEST_TOKENS("large\\23456a", ident("large" + replacement));
    TEST_TOKENS("surrogate\\D800", ident("surrogate" + replacement));
    TEST_TOKENS("surrogate\\0DABC", ident("surrogate" + replacement));
    TEST_TOKENS("\\00DFFFsurrogate", ident(replacement + "surrogate"));
    TEST_TOKENS("\\10fFfF", ident(fromUChar32(0x10ffff)));
    TEST_TOKENS("\\10fFfF0", ident(fromUChar32(0x10ffff) + "0"));
    TEST_TOKENS("\\10000000", ident(fromUChar32(0x100000) + "00"));
    TEST_TOKENS("eof\\", ident("eof" + replacement));
}
Exemplo n.º 4
0
void TexTableFormater::footer() {
	delim();
	delim();
	*out <<"\\end{tabular}"<<std::endl;
//	*out <<"\label{...}"<<endl;
//	*out <<"\caption{...}"<<endl;

};
TEST(CSSTokenizerTest, CommentToken)
{
    TEST_TOKENS("/*comment*/a", ident("a"));
    TEST_TOKENS("/**\\2f**//", delim('/'));
    TEST_TOKENS("/**y*a*y**/ ", whitespace());
    TEST_TOKENS(",/* \n :) \n */)", comma(), rightParenthesis());
    TEST_TOKENS(":/*/*/", colon());
    TEST_TOKENS("/**/*", delim('*'));
    TEST_TOKENS(";/******", semicolon());
}
TEST(CSSTokenizerTest, MultipleCharacterTokens)
{
    TEST_TOKENS("~=", includeMatch());
    TEST_TOKENS("|=", dashMatch());
    TEST_TOKENS("^=", prefixMatch());
    TEST_TOKENS("$=", suffixMatch());
    TEST_TOKENS("*=", substringMatch());
    TEST_TOKENS("||", column());
    TEST_TOKENS("|||", column(), delim('|'));
    TEST_TOKENS("<!--", cdo());
    TEST_TOKENS("<!---", cdo(), delim('-'));
    TEST_TOKENS("-->", cdc());
}
Exemplo n.º 7
0
		void HttpServer::HttpRecv()
		{
			if( is_open_ == false ) 
				return;

            string delim("\r\n\r\n");
			boost::asio::async_read_until(
				socket_, 
				request_, 
				//boost::regex("\r\n\r\n"),
                delim,
				boost::bind(
					&HttpServer::HandleHttpRecv, 
					shared_from_this(),
					boost::asio::placeholders::error,
					boost::asio::placeholders::bytes_transferred
				)
			);
			recv_timer_ = framework::timer::OnceTimer::create(recv_timeout_, shared_from_this());
			recv_timer_->Start();

			notice_window_close_timer_ = framework::timer::PeriodicTimer::create(1000, shared_from_this());
			notice_window_close_timer_->Start();

		}
Exemplo n.º 8
0
	Version::Version(const String& string)
	{
		String delim(Text("."));
		String part;
		SizeT start = 0;

		auto pos = string.Split(delim, part, start);
		while (-1 != pos)
		{
			SizeT value = 0;

			auto raw = part.GetBuffer();
			if (nullptr != raw)
			{
				while (*raw != Text('\0') && !_istdigit(*raw))
				{
					raw++;
				}
				value = _tcstoul(raw, NULL, 10);
			}

			m_parts.push_back(value);
			pos = string.Split(delim, part, start);
		}
	}
Exemplo n.º 9
0
/**
* Scanned eine node section, d.h. von <nodes> bis </nodes> und gibt 
* die resultate an den listener weiter, die anderen scanBlaBlaSection arbeiten
* analog
**/
void XMLFileScanner::scanNodeSection(std::string& text)
{
  StringTokenizer st(text);
  std::string delim(" \n");
  std::string token;
  std::string nodeString;

  token = st.next(delim); //nodes
  token = st.next(delim);
  while(token != "/nodes")
    {
      if(token != "node") 
	throw std::runtime_error("Wrong Format in Node Section discoverd..\n");
		
      while(token != "/node")
	{			
	  token = st.next(delim);
	  //can't find another <node> before a </node>
	  if(token=="node") 
	    throw std::runtime_error("Wrong Format in Node Section discoverd..closing tag missing\n");

	  nodeString += token;
	  nodeString += " ";
	}
      l.scannedNode(nodeString, pos);  //notify listener
      nodeString = "";			//clean string
      token = st.next(delim);
      ++pos;
    }
	
	
  //std::cout <<text<<"\n";
}
Exemplo n.º 10
0
void XMLFileScanner::scanInfoSection(std::string& text)
{
  StringTokenizer st(text);
  std::string delim("\n\r\t ");
  std::string token;

  //TODO derzeit wird nur name des moduls eingelesen...müsste aber eigentlich reichen
  token = st.next(delim); //moduleinfos
  token = st.next(delim); //first moduleinfo
  while(token != "/moduleinfos")
    {
      if(token != "moduleinfo")
	throw std::runtime_error("Error in Format in moduleinfo section discovered..");

      token = st.next(delim);		//module_identifier

      std::string mi(token.substr(1, token.length()-2));
      l.scannedModuleInfo(mi); //notify listener

      while(token != "/moduleinfo")
	{
	  token = st.next(delim);
	  if(token == "moduleinfo")
	    throw std::runtime_error("Error in Format in modulinfo section discovered...closing tag missing...");
	}
      token = st.next(delim); //moduleinfo or /moduleinfos
    }
	
	
}
Exemplo n.º 11
0
void XMLFileScanner::scanCtrlSection(std::string& text)
{
  StringTokenizer st(text);
  std::string delim(" \n");
  std::string token;
  std::string controlString;
	
  token = st.next(delim); //controls
  token = st.next(delim);
  while(token != "/controls")
    {
      if(token != "control") 
	throw std::runtime_error("Wrong Format in control Section discoverd..\n");
		
      while(token != "/control")
	{	
	  token = st.next(delim);
	  if(token=="control") 
	    throw std::runtime_error("Wrong Format in control Section discoverd..closing tag missing\n");
			
	  controlString += token;
	  controlString += " ";
	}

      l.scannedControl(controlString);	
      controlString = "";

      token = st.next(delim);
    }
	
	
  //std::cout <<text<<"\n";
}
Exemplo n.º 12
0
QString PlatformMac::expandEnvironmentVars(QString txt)
{
    QStringList list = QProcess::systemEnvironment();
    txt.replace('~', "$HOME$");
    QString delim("$");
    QString out = "";
    int curPos = txt.indexOf(delim, 0);
    if (curPos == -1) return txt;

    while(curPos != -1)
    {
            int nextPos = txt.indexOf("$", curPos+1);
            if (nextPos == -1)
            {
                    out += txt.mid(curPos+1);
                    break;
            }
            QString var = txt.mid(curPos+1, nextPos-curPos-1);
            bool found = false;
            foreach(QString s, list)
            {
                    if (s.startsWith(var, Qt::CaseInsensitive))
                    {
                            found = true;
                            out += s.mid(var.length()+1);
                            break;
                    }
            }
            if (!found)
                    out += "$" + var;
            curPos = nextPos;
    }
    return out;
}
Exemplo n.º 13
0
void Canvas::fill_row_word_wrapping(std::size_t rw, const std::string& str, std::size_t x_offset, bool centered,
                                    bool prefill, char prefill_char, bool postfill, char postfill_char, std::size_t rw_span) {
    std::stringstream ss_str(str);
    std::string word;
    std::string delim(" ");
    std::size_t line_max_size = cols-x_offset;

    if (ss_str.good()) {
        ss_str >> word;
        debug_println(BIT0,"First word from stringstream: '" << word << "'");
        for (std::size_t i = 0 ; i < rw_span; ++i) {
            std::string line;
            while(true) {
                if (ss_str.eof()) {
                    delim.clear(); //If we're at the last word add no delimiter
                    debug_println(BIT0,"End of stringstream reached, delimiter set to blank");
                }
                if (!add_if_fit(word,line,line_max_size,delim)) {
                    if (centered) x_offset = calculate_x_middle(line.size()) + x_offset; //Adjust x_offset for line centration
                    debug_println(BIT0,"Writing line '" << line << "' to canvas matrix");
                    matrix.fill_row(rw+i,line,x_offset,prefill,prefill_char,postfill,postfill_char);
                    break;
                }
                if (ss_str.good()) {
                    ss_str >> word;
                } else {
                    if (centered) x_offset = calculate_x_middle(line.size()) + x_offset; //Adjust x_offset for line centration
                    matrix.fill_row(rw+i,line,x_offset,prefill,prefill_char,postfill,postfill_char);
                    debug_println(BIT0,"Writing line '" << line << "' to canvas matrix");
                    goto endwhile;
                }
            }
Exemplo n.º 14
0
TEST(CSSTokenizerTest, WhitespaceTokens)
{
    TEST_TOKENS("   ", whitespace());
    TEST_TOKENS("\n\rS", whitespace(), ident("S"));
    TEST_TOKENS("   *", whitespace(), delim('*'));
    TEST_TOKENS("\r\n\f\t2", whitespace(), number(IntegerValueType, 2, NoSign));
}
Exemplo n.º 15
0
void
Compass::Run(const String& command) {
	if (!command.IsEmpty()) {
		String args;
		String delim(L"/");
		command.SubString(String(L"gap://").GetLength(), args);
		StringTokenizer strTok(args, delim);
		if(strTok.GetTokenCount() < 2) {
			AppLogDebug("Not Enough Params");
			return;
		}
		String method;
		strTok.GetNextToken(method);
		// Getting callbackId
		strTok.GetNextToken(callbackId);
		AppLogDebug("Method %S, callbackId: %S", method.GetPointer(), callbackId.GetPointer());
		// used to determine callback ID
		if(method == L"com.phonegap.Compass.watchHeading" && !callbackId.IsEmpty() && !IsStarted()) {
			AppLogDebug("watching compass...");
			StartSensor();
		}
		if(method == L"com.phonegap.Compass.clearWatch" && !callbackId.IsEmpty() && IsStarted()) {
			AppLogDebug("stop watching compass...");
			StopSensor();
		}
		if(method == L"com.phonegap.Compass.getCurrentHeading" && !callbackId.IsEmpty() && !IsStarted()) {
			AppLogDebug("getting current compass...");
			GetLastHeading();
		}
		AppLogDebug("Compass command %S completed", command.GetPointer());
	} else {
		AppLogDebug("Can't run empty command");
	}
}
Exemplo n.º 16
0
TEST(CSSTokenizerTest, AtKeywordToken)
{
    TEST_TOKENS("@at-keyword", atKeyword("at-keyword"));
    TEST_TOKENS("@testing123", atKeyword("testing123"));
    TEST_TOKENS("@hello!", atKeyword("hello"), delim('!'));
    TEST_TOKENS("@-text", atKeyword("-text"));
    TEST_TOKENS("@--abc", atKeyword("--abc"));
    TEST_TOKENS("@--", atKeyword("--"));
    TEST_TOKENS("@--11", atKeyword("--11"));
    TEST_TOKENS("@---", atKeyword("---"));
    TEST_TOKENS("@\\ ", atKeyword(" "));
    TEST_TOKENS("@-\\ ", atKeyword("- "));
    TEST_TOKENS("@@", delim('@'), delim('@'));
    TEST_TOKENS("@2", delim('@'), number(IntegerValueType, 2, NoSign));
    TEST_TOKENS("@-1", delim('@'), number(IntegerValueType, -1, MinusSign));
}
Exemplo n.º 17
0
void
Network::Run(const String& command) {
	if (!command.IsEmpty()) {
		String args;
		String delim(L"/");
		command.SubString(String(L"gap://").GetLength(), args);
		StringTokenizer strTok(args, delim);
		if(strTok.GetTokenCount() < 3) {
			AppLogDebug("Not enough params");
			return;
		}
		String method;
		String hostAddr;
		strTok.GetNextToken(method);
		strTok.GetNextToken(callbackId);
		strTok.GetNextToken(hostAddr);

		// URL decoding
		Uri uri;
		uri.SetUri(hostAddr);
		AppLogDebug("Method %S, callbackId %S, hostAddr %S URI %S", method.GetPointer(), callbackId.GetPointer(), hostAddr.GetPointer(), uri.ToString().GetPointer());
		if(method == L"org.apache.cordova.Network.isReachable") {
			IsReachable(uri.ToString());
		}
		AppLogDebug("Network command %S completed", command.GetPointer());
		} else {
			AppLogDebug("Can't run empty command");
		}
}
Exemplo n.º 18
0
void TexTableFormater::header() {
	//	*out <<"\begin{table}"<<endl;
	//	*out <<"\centering"<<endl;
	*out <<"\\begin{tabular}{|";
	for(int i=0; i<columnTitle.size(); i++) *out<<"c|";
	*out <<"}"<<std::endl;
	delim();
	*out << firstSep;
	for(unsigned int i=0;i<columnTitle.size();i++) {
		*out << std::setw(columnWidth[i])<<columnTitle[i];
		if(i==columnTitle.size()-1) *out<< lastSep;
		else *out << sep;
	}
	*out << std::endl;
	delim();
	delim();
};
Exemplo n.º 19
0
TEST(CSSTokenizerTest, PercentageToken)
{
    TEST_TOKENS("10%", percentage(IntegerValueType, 10));
    TEST_TOKENS("+12.0%", percentage(NumberValueType, 12));
    TEST_TOKENS("-48.99%", percentage(NumberValueType, -48.99));
    TEST_TOKENS("6e-1%", percentage(NumberValueType, 0.6));
    TEST_TOKENS("5%%", percentage(IntegerValueType, 5), delim('%'));
}
Exemplo n.º 20
0
TEST(CSSTokenizerTest, NumberToken)
{
    TEST_TOKENS("10", number(IntegerValueType, 10));
    TEST_TOKENS("12.0", number(NumberValueType, 12));
    TEST_TOKENS("+45.6", number(NumberValueType, 45.6));
    TEST_TOKENS("-7", number(IntegerValueType, -7));
    TEST_TOKENS("010", number(IntegerValueType, 10));
    TEST_TOKENS("10e0", number(NumberValueType, 10));
    TEST_TOKENS("12e3", number(NumberValueType, 12000));
    TEST_TOKENS("3e+1", number(NumberValueType, 30));
    TEST_TOKENS("12E-1", number(NumberValueType, 1.2));
    TEST_TOKENS(".7", number(NumberValueType, 0.7));
    TEST_TOKENS("-.3", number(NumberValueType, -0.3));
    TEST_TOKENS("+637.54e-2", number(NumberValueType, 6.3754));
    TEST_TOKENS("-12.34E+2", number(NumberValueType, -1234));

    TEST_TOKENS("+ 5", delim('+'), whitespace, number(IntegerValueType, 5));
    TEST_TOKENS("-+12", delim('-'), number(IntegerValueType, 12));
    TEST_TOKENS("+-21", delim('+'), number(IntegerValueType, -21));
    TEST_TOKENS("++22", delim('+'), number(IntegerValueType, 22));
    TEST_TOKENS("13.", number(IntegerValueType, 13), delim('.'));
    TEST_TOKENS("1.e2", number(IntegerValueType, 1), delim('.'), ident("e2"));
    TEST_TOKENS("2e3.5", number(NumberValueType, 2000), number(NumberValueType, 0.5));
    TEST_TOKENS("2e3.", number(NumberValueType, 2000), delim('.'));
}
Exemplo n.º 21
0
TEST(CSSTokenizerTest, NumberToken)
{
    TEST_TOKENS("10", number(IntegerValueType, 10, NoSign));
    TEST_TOKENS("12.0", number(NumberValueType, 12, NoSign));
    TEST_TOKENS("+45.6", number(NumberValueType, 45.6, PlusSign));
    TEST_TOKENS("-7", number(IntegerValueType, -7, MinusSign));
    TEST_TOKENS("010", number(IntegerValueType, 10, NoSign));
    TEST_TOKENS("10e0", number(NumberValueType, 10, NoSign));
    TEST_TOKENS("12e3", number(NumberValueType, 12000, NoSign));
    TEST_TOKENS("3e+1", number(NumberValueType, 30, NoSign));
    TEST_TOKENS("12E-1", number(NumberValueType, 1.2, NoSign));
    TEST_TOKENS(".7", number(NumberValueType, 0.7, NoSign));
    TEST_TOKENS("-.3", number(NumberValueType, -0.3, MinusSign));
    TEST_TOKENS("+637.54e-2", number(NumberValueType, 6.3754, PlusSign));
    TEST_TOKENS("-12.34E+2", number(NumberValueType, -1234, MinusSign));

    TEST_TOKENS("+ 5", delim('+'), whitespace(), number(IntegerValueType, 5, NoSign));
    TEST_TOKENS("-+12", delim('-'), number(IntegerValueType, 12, PlusSign));
    TEST_TOKENS("+-21", delim('+'), number(IntegerValueType, -21, MinusSign));
    TEST_TOKENS("++22", delim('+'), number(IntegerValueType, 22, PlusSign));
    TEST_TOKENS("13.", number(IntegerValueType, 13, NoSign), delim('.'));
    TEST_TOKENS("1.e2", number(IntegerValueType, 1, NoSign), delim('.'), ident("e2"));
    TEST_TOKENS("2e3.5", number(NumberValueType, 2000, NoSign), number(NumberValueType, 0.5, NoSign));
    TEST_TOKENS("2e3.", number(NumberValueType, 2000, NoSign), delim('.'));
    TEST_TOKENS("1000000000000000000000000", number(IntegerValueType, 1e24, NoSign));
}
Exemplo n.º 22
0
 const char* non_greedy(const char* src) {
   while (!delim(src)) {
     const char* p = mx(src);
     if (p == src) return 0;
     if (p == 0) return 0;
     src = p;
   }
   return src;
 }
Exemplo n.º 23
0
void RenderSystem::setupResources()
{
  std::string rviz_path = ros::package::getPath(ROS_PACKAGE_NAME);
  Ogre::ResourceGroupManager::getSingleton().addResourceLocation( rviz_path + "/ogre_media", "FileSystem", ROS_PACKAGE_NAME );
  Ogre::ResourceGroupManager::getSingleton().addResourceLocation( rviz_path + "/ogre_media/textures", "FileSystem", ROS_PACKAGE_NAME );
  Ogre::ResourceGroupManager::getSingleton().addResourceLocation( rviz_path + "/ogre_media/fonts", "FileSystem", ROS_PACKAGE_NAME );
  Ogre::ResourceGroupManager::getSingleton().addResourceLocation( rviz_path + "/ogre_media/models", "FileSystem", ROS_PACKAGE_NAME );
  Ogre::ResourceGroupManager::getSingleton().addResourceLocation( rviz_path + "/ogre_media/materials", "FileSystem", ROS_PACKAGE_NAME );
  Ogre::ResourceGroupManager::getSingleton().addResourceLocation( rviz_path + "/ogre_media/materials/scripts", "FileSystem", ROS_PACKAGE_NAME );
  Ogre::ResourceGroupManager::getSingleton().addResourceLocation( rviz_path + "/ogre_media/materials/glsl120", "FileSystem", ROS_PACKAGE_NAME );
  Ogre::ResourceGroupManager::getSingleton().addResourceLocation( rviz_path + "/ogre_media/materials/glsl120/nogp", "FileSystem", ROS_PACKAGE_NAME );
  // Add resources that depend on a specific glsl version.
  // Unfortunately, Ogre doesn't have a notion of glsl versions so we can't go
  // the 'official' way of defining multiple schemes per material and let Ogre decide which one to use.
  if ( getGlslVersion() >= 150  )
  {
    Ogre::ResourceGroupManager::getSingleton().addResourceLocation( rviz_path + "/ogre_media/materials/glsl150", "FileSystem", ROS_PACKAGE_NAME );
    Ogre::ResourceGroupManager::getSingleton().addResourceLocation( rviz_path + "/ogre_media/materials/scripts150", "FileSystem", ROS_PACKAGE_NAME );
  }
  else if ( getGlslVersion() >= 120  )
  {
    Ogre::ResourceGroupManager::getSingleton().addResourceLocation( rviz_path + "/ogre_media/materials/scripts120", "FileSystem", ROS_PACKAGE_NAME );
  }
  else
  {
    std::string s = "Your graphics driver does not support OpenGL 2.1. Please enable software rendering before running RViz (e.g. type 'export LIBGL_ALWAYS_SOFTWARE=1').";
    QMessageBox msgBox;
    msgBox.setText(s.c_str());
    msgBox.exec();
    throw std::runtime_error( s );
  }

  // Add paths exported to the "media_export" package.
  std::vector<std::string> media_paths;
  ros::package::getPlugins( "media_export", "ogre_media_path", media_paths );
  std::string delim(":");
  for( std::vector<std::string>::iterator iter = media_paths.begin(); iter != media_paths.end(); iter++ )
  {
    if( !iter->empty() )
    {
      std::string path;
      int pos1 = 0;
      int pos2 = iter->find(delim);
      while( pos2 != (int)std::string::npos )
      {
        path = iter->substr( pos1, pos2 - pos1 );
        ROS_DEBUG("adding resource location: '%s'\n", path.c_str());
        Ogre::ResourceGroupManager::getSingleton().addResourceLocation( path, "FileSystem", ROS_PACKAGE_NAME );
        pos1 = pos2 + 1;
        pos2 = iter->find( delim, pos2 + 1 );
      }
      path = iter->substr( pos1, iter->size() - pos1 );
      ROS_DEBUG("adding resource location: '%s'\n", path.c_str());
      Ogre::ResourceGroupManager::getSingleton().addResourceLocation( path, "FileSystem", ROS_PACKAGE_NAME );
    }
  }
}
Exemplo n.º 24
0
TEST(CSSTokenizerTest, MultipleCharacterTokens)
{
    TEST_TOKENS("~=", includeMatch);
    TEST_TOKENS("|=", dashMatch);
    TEST_TOKENS("^=", prefixMatch);
    TEST_TOKENS("$=", suffixMatch);
    TEST_TOKENS("*=", substringMatch);
    TEST_TOKENS("||", column);
    TEST_TOKENS("|||", column, delim('|'));
}
Exemplo n.º 25
0
int main(int argc, char* argv[])
{
  std::string s = "This is a test,  like  , of the boost tokenizer class.";
  boost::char_separator<char> delim(" ,\t.");
  boost::tokenizer<boost::char_separator<char>> t(s, delim);
  for ( boost::tokenizer<boost::char_separator<char>>::iterator it = t.begin(), end; end != it; it++ )
  {
    std::cout << *it << std::endl;
  }
	return 0;
}
Exemplo n.º 26
0
TEST(CSSTokenizerTest, CommentToken)
{
    TEST_TOKENS("/*comment*/", comment);
    TEST_TOKENS("/**\\2f**/", comment);
    TEST_TOKENS("/**y*a*y**/", comment);
    TEST_TOKENS("/* \n :) \n */", comment);
    TEST_TOKENS("/*/*/", comment);
    TEST_TOKENS("/**/*", comment, delim('*'));
    // FIXME: Should an EOF-terminated comment get a token?
    // TEST_TOKENS("/******", comment);
}
Exemplo n.º 27
0
int main(int argc, char const *argv[])
{
	char *str = "abc.123";
	char *ptr = NULL;
	printf("before str %s\n",str);
	ptr = delim(&str,'.');
	printf("%s\n", ptr);
	//str++;
	printf("after str %s\n",str);
	return 0;
}
std::string parentName(const std::string& name)
{
  std::list<std::string> list_string;
  std::string delim("/");
  boost::split(list_string, name, boost::is_any_of(delim));

  if (list_string.size() > 0) {
    list_string.pop_back();
  }
  return boost::algorithm::join(list_string, "/");
}
Exemplo n.º 29
0
std::vector<std::string> ClassStructure::splitCppNamespace(std::string className) {
  std::string delim("::");
  std::vector<std::string> out;
  std::size_t start = 0;
  std::size_t end = 0;
  while ((end = className.find(delim, start)) != std::string::npos) {
    out.push_back(className.substr(start, end - start));
    start = end + 2;
  }
  out.push_back(className.substr(start));
  return out;
}
Exemplo n.º 30
0
TEST(CSSTokenizerTest, IdentToken)
{
    TEST_TOKENS("simple-ident", ident("simple-ident"));
    TEST_TOKENS("testing123", ident("testing123"));
    TEST_TOKENS("hello!", ident("hello"), delim('!'));
    TEST_TOKENS("world\5", ident("world"), delim('\5'));
    TEST_TOKENS("_under score", ident("_under"), whitespace, ident("score"));
    TEST_TOKENS("-_underscore", ident("-_underscore"));
    TEST_TOKENS("-text", ident("-text"));
    TEST_TOKENS("-\\6d", ident("-m"));
    TEST_TOKENS("--abc", ident("--abc"));
    TEST_TOKENS("--", ident("--"));
    TEST_TOKENS("--11", ident("--11"));
    TEST_TOKENS("---", ident("---"));
    TEST_TOKENS(fromUChar32(0x2003), ident(fromUChar32(0x2003))); // em-space
    TEST_TOKENS(fromUChar32(0xA0), ident(fromUChar32(0xA0))); // non-breaking space
    TEST_TOKENS(fromUChar32(0x1234), ident(fromUChar32(0x1234)));
    TEST_TOKENS(fromUChar32(0x12345), ident(fromUChar32(0x12345)));
    // FIXME: Preprocessing is supposed to replace U+0000 with U+FFFD
    // TEST_TOKENS("\0", ident(fromUChar32(0xFFFD)));
}