本文整理汇总了C++中delim函数的典型用法代码示例。如果您正苦于以下问题:C++ delim函数的具体用法?C++ delim怎么用?C++ delim使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了delim函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: TEST
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"));
}
开发者ID:eth-srl,项目名称:BlinkER,代码行数:32,代码来源:CSSTokenizerTest.cpp
示例2: TEST
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));
}
开发者ID:OctiumBrowser,项目名称:octium-main,代码行数:34,代码来源:CSSTokenizerTest.cpp
示例3: delim
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();
}
开发者ID:huangyt,项目名称:MyProjects,代码行数:25,代码来源:HttpServer.cpp
示例4: delim
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);
}
}
开发者ID:alexander-borodulya,项目名称:WinToolsLib,代码行数:25,代码来源:Version.cpp
示例5: st
/**
* 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";
}
开发者ID:ChristianFrisson,项目名称:gephex,代码行数:38,代码来源:xmlscanner.cpp
示例6: delim
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;
}
开发者ID:lbl1985,项目名称:launchy,代码行数:34,代码来源:platform_mac.cpp
示例7: ss_str
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;
}
}
开发者ID:kwabe007,项目名称:spel-spelet,代码行数:32,代码来源:canvas.cpp
示例8: delim
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");
}
}
开发者ID:OldFrank,项目名称:phonegap,代码行数:34,代码来源:Compass.cpp
示例9: delim
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");
}
}
开发者ID:AjayTShephertz,项目名称:phonegap,代码行数:29,代码来源:Network.cpp
示例10: non_greedy
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;
}
开发者ID:aymerick,项目名称:kowa,代码行数:9,代码来源:lexer.hpp
示例11: if
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 );
}
}
}
开发者ID:CURG,项目名称:rviz,代码行数:57,代码来源:render_system.cpp
示例12: main
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;
}
开发者ID:brett-johnson,项目名称:prototypes,代码行数:11,代码来源:proto9977.cpp
示例13: main
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;
}
开发者ID:hitdog13,项目名称:intev,代码行数:11,代码来源:delim.c
示例14: parentName
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, "/");
}
开发者ID:jsk-ros-pkg,项目名称:jsk_common,代码行数:11,代码来源:standalone_complexed_nodelet.cpp
示例15: delim
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;
}
开发者ID:ASvyatkovskiy,项目名称:rootconverter,代码行数:12,代码来源:streamerToCode.cpp
注:本文中的delim函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论