• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ separator函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中separator函数的典型用法代码示例。如果您正苦于以下问题:C++ separator函数的具体用法?C++ separator怎么用?C++ separator使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了separator函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: input

wxString* PROJECT_TEMPLATE::GetTitle(void)
{
    wxFileInputStream input( GetHtmlFile().GetFullPath() );
    wxString separator( wxT( "\x9" ) );
    wxTextInputStream text( input, separator, wxConvUTF8 );

    /* Open HTML file and get the text between the title tags */
    if( title == wxEmptyString )
    {
        int start = 0;
        int finish = 0;
        bool done = false;

        while( input.IsOk() && !input.Eof() && !done )
        {
            wxString line = text.ReadLine();

            start = line.Find( wxT( "<title>" ) );
            if( start == wxNOT_FOUND )
                start = line.Find( wxT( "<TITLE>" ) );

            finish = line.Find( wxT( "</title>" ) );
            if( finish == wxNOT_FOUND )
                finish = line.Find( wxT( "</TITLE>" ) );

            // find the opening tag
            if( start != wxNOT_FOUND )
            {
                if( finish != wxNOT_FOUND )
                {
                    title = line.SubString( start + 7, finish );
                }
                else
                {
                    title = line.SubString( start + 7, line.Len() - 1 );
                    done = true;
                }
            }
            else
            {
                if( finish != wxNOT_FOUND )
                {
                    title += line.SubString( 0, finish );
                    done = true;
                }
                else
                {
                    title += line;
                }
            }

            // Remove line endings
            title.Replace( wxT( "\r" ), wxT( "" ) );
            title.Replace( wxT( "\n" ), wxT( "" ) );
        }
    }

    return &title;
}
开发者ID:barrem,项目名称:kicad-source-mirror,代码行数:59,代码来源:project_template.cpp


示例2: clear

void PathListEditor::setPathList(const QString &pathString)
{
    if (pathString.isEmpty()) {
        clear();
    } else {
        setPathList(pathString.split(separator(), QString::SkipEmptyParts));
    }
}
开发者ID:KDE,项目名称:android-qt-creator,代码行数:8,代码来源:pathlisteditor.cpp


示例3: Split

 /*! \fn
   * Split a line (series of characters) with the given delimiter
   * @param line Input string in order to be split by the given delimiter
   * @param delim Series of delimiters (each delimiter character is followed by the next one in a single string variable) in order to split the given string
   * @return Vector of elements of the given string that have been split by the given delimiter(s)
   */
 inline std::vector<std::string> Split(std::string line, std::string delim)
 {
     boost::char_separator<char> separator(delim.c_str());
     boost::tokenizer< boost::char_separator<char> > tokens(line, separator);
     std::vector<std::string> vectorTokens = std::vector<std::string>();
     vectorTokens.assign(tokens.begin(), tokens.end());
     return vectorTokens;
 }
开发者ID:hainm,项目名称:gmml,代码行数:14,代码来源:utils.hpp


示例4: _collision_sphere_convex_polygon

static void _collision_sphere_convex_polygon(const ShapeSW *p_a, const Transform &p_transform_a, const ShapeSW *p_b, const Transform &p_transform_b, _CollectorCallback *p_collector, real_t p_margin_a, real_t p_margin_b) {

	const SphereShapeSW *sphere_A = static_cast<const SphereShapeSW *>(p_a);
	const ConvexPolygonShapeSW *convex_polygon_B = static_cast<const ConvexPolygonShapeSW *>(p_b);

	SeparatorAxisTest<SphereShapeSW, ConvexPolygonShapeSW, withMargin> separator(sphere_A, p_transform_a, convex_polygon_B, p_transform_b, p_collector, p_margin_a, p_margin_b);

	if (!separator.test_previous_axis())
		return;

	const Geometry::MeshData &mesh = convex_polygon_B->get_mesh();

	const Geometry::MeshData::Face *faces = mesh.faces.ptr();
	int face_count = mesh.faces.size();
	const Geometry::MeshData::Edge *edges = mesh.edges.ptr();
	int edge_count = mesh.edges.size();
	const Vector3 *vertices = mesh.vertices.ptr();
	int vertex_count = mesh.vertices.size();

	// faces of B
	for (int i = 0; i < face_count; i++) {

		Vector3 axis = p_transform_b.xform(faces[i].plane).normal;

		if (!separator.test_axis(axis))
			return;
	}

	// edges of B
	for (int i = 0; i < edge_count; i++) {

		Vector3 v1 = p_transform_b.xform(vertices[edges[i].a]);
		Vector3 v2 = p_transform_b.xform(vertices[edges[i].b]);
		Vector3 v3 = p_transform_a.origin;

		Vector3 n1 = v2 - v1;
		Vector3 n2 = v2 - v3;

		Vector3 axis = n1.cross(n2).cross(n1).normalized();

		if (!separator.test_axis(axis))
			return;
	}

	// vertices of B
	for (int i = 0; i < vertex_count; i++) {

		Vector3 v1 = p_transform_b.xform(vertices[i]);
		Vector3 v2 = p_transform_a.origin;

		Vector3 axis = (v2 - v1).normalized();

		if (!separator.test_axis(axis))
			return;
	}

	separator.generate_contacts();
}
开发者ID:Max-Might,项目名称:godot,代码行数:58,代码来源:collision_solver_sat.cpp


示例5: foo

int foo(void) {
  // Both MSVC and GCC do the ++ after the assignment !
  *buffp = buffer[(*buffa) ++];
  separator(1);
  // Both MSVC and GCC do the ++ before the call to bar !
  // buffb is incremented first in both compilers
  *buffp = bar(buffer[(*buffa) ++] + buffer[(*buffb) ++]);
  separator(2);
  // The +7 must be done before the assignment
  *buffp = buffer[(*buffa) += 7];
  separator(3);
  bar((*buffa) ++) + bar((*buffb) ++);

  separator(4);
  buffer[*buffp + 4] = buffer[(*buffa) ++] + f2(f1((*buffb)++), (*buffc) ++);
  
  return *buffp;
}
开发者ID:CARV-ICS-FORTH,项目名称:scoop,代码行数:18,代码来源:order.c


示例6: UserString

void OptionsDB::GetUsage(std::ostream& os, const std::string& command_line/* = ""*/) const {
    os << UserString("COMMAND_LINE_USAGE") << command_line << "\n";

    int longest_param_name = 0;
    for (const std::map<std::string, Option>::value_type& option : m_options) {
        if (longest_param_name < static_cast<int>(option.first.size()))
            longest_param_name = option.first.size();
    }

    int description_column = 5;
    int description_width = 80 - description_column;

    if (description_width <= 0)
        throw std::runtime_error("The longest parameter name leaves no room for a description.");

    for (const std::map<std::string, Option>::value_type& option : m_options) {
        // Ignore unrecognized options that have not been formally registered
        // with Add().
        if (!option.second.recognized)
            continue;

        if (option.second.short_name)
            os << "-" << option.second.short_name << ", --" << option.second.name << "\n";
        else
            os << "--" << option.second.name << "\n";

        os << std::string(description_column - 1, ' ');

        typedef boost::tokenizer<boost::char_separator<char>> Tokenizer;
        boost::char_separator<char> separator(" \t");
        Tokenizer tokens(UserString(option.second.description), separator);
        int curr_column = description_column;
        for (const Tokenizer::value_type& token : tokens) {
            if (80 < curr_column + token.size()) {
                os << "\n" << std::string(description_column, ' ') << token;
                curr_column = description_column + token.size();
            } else {
                os << " " << token;
                curr_column += token.size() + 1;
            }
        }

        if (option.second.validator) {
            std::stringstream stream;
            stream << UserString("COMMAND_LINE_DEFAULT") << option.second.DefaultValueToString();
            if (80 < curr_column + stream.str().size() + 3) {
                os << "\n" << std::string(description_column, ' ') << stream.str() << "\n";
            } else {
                os << " | " << stream.str() << "\n";
            }
        } else {
            os << "\n";
        }
        os << "\n";
    }
}
开发者ID:MatGB,项目名称:freeorion,代码行数:56,代码来源:OptionsDB.cpp


示例7: StringToList

std::vector<std::string> StringToList(const std::string& input_string) {
    std::vector<std::string> retval;
    typedef boost::tokenizer<boost::char_separator<char>> Tokenizer;
    boost::char_separator<char> separator(",");
    Tokenizer tokens(input_string, separator);
    for (const Tokenizer::value_type& token : tokens) {
        retval.push_back(token);
    }
    return retval;
}
开发者ID:MatGB,项目名称:freeorion,代码行数:10,代码来源:OptionsDB.cpp


示例8: getNextFilePath

std::string UDir::getNextFilePath()
{
	std::string filePath;
	if(iFileName_ != fileNames_.end())
	{
		filePath = path_+separator()+*iFileName_;
		++iFileName_;
	}
	return filePath;
}
开发者ID:matlabbe,项目名称:utilite,代码行数:10,代码来源:UDir.cpp


示例9: separator

/**
 * Adds a border & timestamp to the message
 * @param msg
 * @return A new string with the required formatting
 */
QString ScriptOutputDisplay::addTimestamp(const QString &msg) {
  QString separator(75, '-');
  QString timestamped = "%1\n"
                        "%2: %3\n"
                        "%4\n";
  timestamped =
      timestamped.arg(separator, QDateTime::currentDateTime().toString(),
                      msg.trimmed(), separator);
  return timestamped;
}
开发者ID:liyulun,项目名称:mantid,代码行数:15,代码来源:ScriptOutputDisplay.cpp


示例10: separator

void ArSocket::separateHost(const char *rawHost, int rawPort, char *useHost, 
			    size_t useHostSize, int *port)
{
  if (useHost == NULL)
  {
    ArLog::log(ArLog::Normal, "ArSocket: useHost was NULL");
    return;
  }
  if (port == NULL)
  {
    ArLog::log(ArLog::Normal, "ArSocket: port was NULL");
    return;
  }

  useHost[0] = '\0';

  if (rawHost == NULL || rawHost[0] == '\0')
  {
    ArLog::log(ArLog::Normal, "ArSocket: rawHost was NULL or empty");
    return;
  }
  
  ArArgumentBuilder separator(512, ':');
  separator.add(rawHost);

  if (separator.getArgc() <= 0)
  {
    ArLog::log(ArLog::Normal, "ArSocket: rawHost was empty");
    return;
  }
  if (separator.getArgc() == 1)
  {
    snprintf(useHost, useHostSize, separator.getArg(0));
    *port = rawPort;
    return;
  }
  if (separator.getArgc() == 2)
  {
    if (separator.isArgInt(1))
    {
      snprintf(useHost, useHostSize, separator.getArg(0));
      *port = separator.getArgInt(1);
      return;
    }
    else
    {
      ArLog::log(ArLog::Normal, "ArSocket: port given in hostname was not an integer it was %s", separator.getArg(1));
      return;
    }
  }

  // if we get down here there's too many args
  ArLog::log(ArLog::Normal, "ArSocket: too many arguments in hostname %s", separator.getFullString());
  return;
}
开发者ID:sanyaade-research-hub,项目名称:aria,代码行数:55,代码来源:ArSocket.cpp


示例11: tree_output

static void
tree_output()
{
     Symbol **symbols, *main_sym;
     int i, num;
     
     /* Collect and sort symbols */
     num = collect_symbols(&symbols, is_var);
     qsort(symbols, num, sizeof(*symbols), compare);
     /* Scan and mark the recursive ones */
     for (i = 0; i < num; i++) {
	  if (symbols[i]->callee)
	       scan_tree(0, symbols[i]);
     }
     
     /* Produce output */
    begin();
    
    if (reverse_tree) {
	 for (i = 0; i < num; i++) {
	      inverted_tree(0, 0, symbols[i]);
	      separator();
	 }
    } else {
	 main_sym = lookup(start_name);
	 if (main_sym) {
	      direct_tree(0, 0, main_sym);
	      separator();
	 } else {
	      for (i = 0; i < num; i++) {
		   if (symbols[i]->callee == NULL)
			continue;
		   direct_tree(0, 0, symbols[i]);
		   separator();
	      }
	 }
    }
    
    end();
    
    free(symbols);
}
开发者ID:samael65535,项目名称:cflow,代码行数:42,代码来源:output.c


示例12: _collision_circle_rectangle

static void _collision_circle_rectangle(const Shape2DSW* p_a,const Matrix32& p_transform_a,const Shape2DSW* p_b,const Matrix32& p_transform_b,_CollectorCallback2D *p_collector,const Vector2& p_motion_a,const Vector2& p_motion_b,float p_margin_A,float p_margin_B) {

	const CircleShape2DSW *circle_A = static_cast<const CircleShape2DSW*>(p_a);
	const RectangleShape2DSW *rectangle_B = static_cast<const RectangleShape2DSW*>(p_b);


	SeparatorAxisTest2D<CircleShape2DSW,RectangleShape2DSW,castA,castB,withMargin> separator(circle_A,p_transform_a,rectangle_B,p_transform_b,p_collector,p_motion_a,p_motion_b,p_margin_A,p_margin_B);

	if (!separator.test_previous_axis())
		return;

	if (!separator.test_cast())
		return;

	const Vector2 &sphere=p_transform_a.elements[2];
	const Vector2 *axis=&p_transform_b.elements[0];
//	const Vector2& half_extents = rectangle_B->get_half_extents();

	if (!separator.test_axis(axis[0].normalized()))
		return;

	if (!separator.test_axis(axis[1].normalized()))
		return;

	Matrix32 binv = p_transform_b.affine_inverse();
	{

		if (!separator.test_axis( rectangle_B->get_circle_axis(p_transform_b,binv,sphere ) ) )
			return;
	}

	if (castA) {

		Vector2 sphereofs = sphere + p_motion_a;
		if (!separator.test_axis( rectangle_B->get_circle_axis(p_transform_b,binv, sphereofs) ) )
			return;
	}

	if (castB) {

		Vector2 sphereofs = sphere - p_motion_b;
		if (!separator.test_axis( rectangle_B->get_circle_axis(p_transform_b,binv, sphereofs) ) )
			return;
	}

	if (castA && castB) {

		Vector2 sphereofs = sphere - p_motion_b + p_motion_a;
		if (!separator.test_axis( rectangle_B->get_circle_axis(p_transform_b,binv, sphereofs) ) )
			return;
	}

	separator.generate_contacts();
}
开发者ID:3miu,项目名称:godot,代码行数:54,代码来源:collision_solver_2d_sat.cpp


示例13: eolDelimiter

static QString eolDelimiter(const QString& str)
{
  // find the split character
  QString separator('\n');
  if (str.indexOf("\r\n") != -1) {
    separator = "\r\n";
  } else if (str.indexOf('\r') != -1 ) {
    separator = '\r';
  }
  return separator;
}
开发者ID:UIKit0,项目名称:kate,代码行数:11,代码来源:btparser.cpp


示例14: separator

std::string MixAll::filterIP(const std::string& addr) {
    std::string separator(",");
    if (addr.find(separator) == std::string::npos) {
        return addr;
    } else {
        std::vector<std::string> ips;
        std::string::size_type previous = 0;
        std::string::size_type current = std::string::npos;
        while ((current = addr.find(separator, previous)) != std::string::npos) {
            std::string ip = addr.substr(previous, current - previous);
            ips.push_back(ip);
            previous = current + 1;

            if (current == addr.find_last_of(separator)) {
                ips.push_back(addr.substr(previous));
                break;
            }
        }

        struct ifaddrs* if_addr = nullptr;
        if (getifaddrs(&if_addr) == -1) {
            // TODO log error.
            std::cout << "Failed to execute getifaddrs()" << std::endl;
        }

        // Choose IP that share the same subnet with current host.
        for (std::vector<std::string>::iterator it = ips.begin(); it != ips.end(); it++) {
            struct sockaddr_in sock;
            inet_pton(AF_INET, it->c_str(), &sock.sin_addr.s_addr);
            struct ifaddrs* p = if_addr;
            while (p != nullptr) {
                if(p->ifa_addr->sa_family == AF_INET) {
                    struct sockaddr_in* ip_addr = (struct sockaddr_in*)p->ifa_addr;
                    struct sockaddr_in* netmask_addr = (struct sockaddr_in*)p->ifa_netmask;
                    if ((ip_addr->sin_addr.s_addr & netmask_addr->sin_addr.s_addr) == (sock.sin_addr.s_addr & netmask_addr->sin_addr.s_addr)) {
                        return *it;
                    }
                }
                p = p->ifa_next;
            }
        }

        // If not found in the previous step, choose a public IP address.
        for (std::string ip : ips) {
            if (is_public_ip(ip)) {
                return ip;
            }
        }

        // Just return the first one and warn.
        std::cout << "Unable to figure out an ideal IP, returning the first candiate." << std::endl;
        return ips[0];
    }
}
开发者ID:yaosiming,项目名称:vesselmq-client4c,代码行数:54,代码来源:MixAll.cpp


示例15: eolDelimiter

static QString eolDelimiter(const QString &str)
{
    // find the split character
    QString separator(QLatin1Char('\n'));
    if (str.indexOf(QStringLiteral("\r\n")) != -1) {
        separator = QStringLiteral("\r\n");
    } else if (str.indexOf(QLatin1Char('\r')) != -1) {
        separator = QLatin1Char('\r');
    }
    return separator;
}
开发者ID:benpope82,项目名称:kate,代码行数:11,代码来源:btparser.cpp


示例16: QProcess

void HdrCreationManager::align_with_ais() {
	ais=new QProcess(0);
	ais->setWorkingDirectory(qtpfsgui_options->tempfilespath);
	QStringList env = QProcess::systemEnvironment();
	#ifdef WIN32
	QString separator(";");
	#else
	QString separator(":");
	#endif
	env.replaceInStrings(QRegExp("^PATH=(.*)", Qt::CaseInsensitive), "PATH=\\1"+separator+QCoreApplication::applicationDirPath());
	ais->setEnvironment(env);
	connect(ais, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(ais_finished(int,QProcess::ExitStatus)));
	connect(ais, SIGNAL(error(QProcess::ProcessError)), this, SIGNAL(ais_failed(QProcess::ProcessError)));
	
	#ifdef Q_WS_MAC
	ais->start(QCoreApplication::applicationDirPath()+"/align_image_stack", qtpfsgui_options->align_image_stack_options << (filesToRemove.empty() ? fileList : filesToRemove) );
	#else
	ais->start("align_image_stack", qtpfsgui_options->align_image_stack_options << (filesToRemove.empty() ? fileList : filesToRemove) );
	#endif
}
开发者ID:adrianogebertgomes,项目名称:BUG,代码行数:20,代码来源:HdrCreationManager.cpp


示例17: getFile

std::string getFile(const std::string& path)
{
    auto position = path.rfind(separator());

    if(position == std::string::npos)
    {
        return "";
    }

    return path.substr(position + 1);
}
开发者ID:sudnya,项目名称:video-classifier,代码行数:11,代码来源:paths.cpp


示例18: stripTrailingSeparators

std::string stripTrailingSeparators(const std::string& originalPath)
{
    auto path = originalPath;

    while(!path.empty() && path.back() == separator())
    {
        path.resize(path.size() - 1);
    }

    return path;
}
开发者ID:sudnya,项目名称:video-classifier,代码行数:11,代码来源:paths.cpp


示例19: need_full

static int need_full(T_CHAR* ptr)
{
	if (is_roman(ptr)) return 1;
	if (sepcmp(ptr,_TX("RPG"))) return 1;
	while(!separator(*ptr))
	{
		if (*ptr<'0' || *ptr>'9') return 0;
		ptr++;
	}
	return 1;
}
开发者ID:Antokolos,项目名称:instead-android-ng,代码行数:11,代码来源:tagz.cpp


示例20: main

int main() {
	u32 i;

	TEST_DECLARE(1, "ATOMIC_INIT() + atomic_read()");
	ATOMIC_INIT(&a8);
	ATOMIC_INIT(&a16);
	ATOMIC_INIT(&a32);
	i = atomic_read(&a32);
	if (i) {
		printf("a32 == %u, should be 0\n", i);
		TEST_FAILURE(1);
	} else
		TEST_PASSED(1);
	separator();

	TEST_DECLARE(2, "atomic_set_u32()");
	atomic_set_u32(&a32, 5);
	i = atomic_read(&a32);
	if (i != 5) {
		printf("a32 == %u, should be 5\n", i);
		TEST_FAILURE(2);
	} else
		TEST_PASSED(2);
	separator();

	TEST_DECLARE(3, "atomic_dec_and_test_u32()");
	i = 5;
	while (!atomic_dec_and_test_u32(&a32)) --i;
	if (i != 1) {
		printf("dec and test failed, i=%d\n", i);
		TEST_FAILURE(3);
	} else
		TEST_PASSED(3);
	separator();


	printf("tests failed: %d, tests passed: %d\n",
			TESTS_FAILED, TESTS_PASSED);

	return TESTS_FAILED;
}
开发者ID:virtuoso,项目名称:koowaldah,代码行数:41,代码来源:atomic-unit.c



注:本文中的separator函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ seprint函数代码示例发布时间:2022-05-30
下一篇:
C++ sep函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap