当前位置: 首页>>代码示例>>C++>>正文


C++ Lines::push_back方法代码示例

本文整理汇总了C++中Lines::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ Lines::push_back方法的具体用法?C++ Lines::push_back怎么用?C++ Lines::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Lines的用法示例。


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

示例1: splitLines

void Context::splitLines()
{
    for (auto line = lines.begin(); line != lines.end(); ++line)
    {
        auto &text = line->text;
        auto p = text.find('\n');
        if (p == text.npos)
            continue;

        size_t old_pos = 0;
        Lines ls;
        while (1)
        {
            ls.push_back(Line{text.substr(old_pos, p - old_pos), line->n_indents});
            p++;
            old_pos = p;
            p = text.find('\n', p);
            if (p == text.npos)
            {
                ls.push_back(Line{ text.substr(old_pos), line->n_indents });
                break;
            }
        }
        lines.insert(line, ls.begin(), ls.end());
        line = lines.erase(line);
        line--;
    }
}
开发者ID:cppan,项目名称:cppan,代码行数:28,代码来源:context.cpp

示例2: to_lines

inline Lines to_lines(const Polygon &poly) 
{
    Lines lines;
    lines.reserve(poly.points.size());
    for (Points::const_iterator it = poly.points.begin(); it != poly.points.end()-1; ++it)
        lines.push_back(Line(*it, *(it + 1)));
    lines.push_back(Line(poly.points.back(), poly.points.front()));
    return lines;
}
开发者ID:jiripech,项目名称:Slic3r,代码行数:9,代码来源:Polygon.hpp

示例3:

Lines
Polygon::lines() const
{
    Lines lines;
    for (int i = 0; i < this->points.size()-1; i++) {
        lines.push_back(Line(this->points[i], this->points[i+1]));
    }
    lines.push_back(Line(this->points.back(), this->points.front()));
    return lines;
}
开发者ID:4ZM,项目名称:Slic3r,代码行数:10,代码来源:Polygon.cpp

示例4:

Lines
Polygon::lines() const
{
    Lines lines;
    lines.reserve(this->points.size());
    for (Points::const_iterator it = this->points.begin(); it != this->points.end()-1; ++it) {
        lines.push_back(Line(*it, *(it + 1)));
    }
    lines.push_back(Line(this->points.back(), this->points.front()));
    return lines;
}
开发者ID:151706061,项目名称:Slic3r,代码行数:11,代码来源:Polygon.cpp

示例5: to_lines

inline Lines to_lines(const ExPolygon &src) 
{
    size_t n_lines = src.contour.points.size();
    for (size_t i = 0; i < src.holes.size(); ++ i)
        n_lines += src.holes[i].points.size();
    Lines lines;
    lines.reserve(n_lines);
    for (size_t i = 0; i <= src.holes.size(); ++ i) {
        const Polygon &poly = (i == 0) ? src.contour : src.holes[i - 1];
        for (Points::const_iterator it = poly.points.begin(); it != poly.points.end()-1; ++it)
            lines.push_back(Line(*it, *(it + 1)));
        lines.push_back(Line(poly.points.back(), poly.points.front()));
    }
    return lines;
}
开发者ID:jiripech,项目名称:Slic3r,代码行数:15,代码来源:ExPolygon.hpp

示例6: catch

void
Parser::write(std::list<string>& args)
{
    DirectoryPrx dir = _dirs.front();
    string name = args.front();
    args.pop_front();
    NodeDesc d;
    try
    {
        d = dir->find(name);
    }
    catch(const NoSuchName&)
    {
        cout << "`" << name << "': no such file" << endl;
        return;
    }
    if(d.type == DirType)
    {
        cout << "`" << name << "': not a file" << endl;
        return;
    }
    FilePrx f = FilePrx::uncheckedCast(d.proxy);

    Lines l;
    for(std::list<string>::const_iterator i = args.begin(); i != args.end(); ++i)
    {
        l.push_back(*i);
    }
    f->write(l);
}
开发者ID:BlackHoleJet,项目名称:freeze,代码行数:30,代码来源:Parser.cpp

示例7: FlushLinesFromTerminatedProcess

Lines NewlineFilter::FlushLinesFromTerminatedProcess(DWORD pid, HANDLE handle)
{
    Lines lines;
    if (m_lineBuffers.find(pid) != m_lineBuffers.end())
    {
        if (!m_lineBuffers[pid].empty())
        {
            // timestamp not filled, this will be done by the loopback source
            lines.push_back(Line(0, FILETIME(), pid, "<flush>", m_lineBuffers[pid], nullptr));
        }
        m_lineBuffers.erase(pid);
    }
    auto processName = Str(ProcessInfo::GetProcessName(handle)).str();
    auto info = ProcessInfo::GetProcessInfo(handle);
    std::string infoStr = stringbuilder() << "<process started at " << info << " has now terminated>";
    lines.push_back(Line(0, FILETIME(), pid, processName, infoStr, nullptr));
    return lines;
}
开发者ID:JayceM6,项目名称:DebugViewPP,代码行数:18,代码来源:NewlineFilter.cpp

示例8: GetLines

Lines GetLines(const CEdges& edges)
{
	Lines res;

	for (CEdges::const_iterator it = edges.begin(); it != edges.end(); ++it)
	{
		res.push_back(it->GetLine());
	}

	return res;
}
开发者ID:maleiwhat,项目名称:vectorizing-project,代码行数:11,代码来源:Edge.cpp

示例9: get_starts

Lines get_starts(TextIter Xi, TextIter Yi) {
    Lines lines;
    int C = Xi.compare(Yi);
    while (C < 0) {
        lines.push_back(Xi.get_offset());
        if (!Xi.forward_line())
            break;
        C = Xi.compare(Yi);
    }
    return lines;
}
开发者ID:loadavg,项目名称:collectdcp,代码行数:11,代码来源:view_ast.cpp

示例10: ProcessLine

Lines DBWinReader::ProcessLine(const Line& line)
{
	Lines lines;
	if (m_lineBuffers.find(line.pid) == m_lineBuffers.end())
	{
		std::string message;
		message.reserve(4000);
		m_lineBuffers[line.pid] = std::move(message);
	}
	std::string& message = m_lineBuffers[line.pid];

	Line outputLine = line;
	for (auto i = line.message.begin(); i != line.message.end(); i++)
	{
		if (*i == '\r')
			continue;

		if (*i == '\n')
		{
			outputLine.message = std::move(message);
			message.clear();
			lines.push_back(outputLine);
		}
		else
		{
			message.push_back(char(*i));
		}
	}

	if (message.empty())
	{
		m_lineBuffers.erase(line.pid);
	}
	else if (m_autoNewLine || message.size() > 8192)	// 8k line limit prevents stack overflow in handling code 
	{
		outputLine.message = std::move(message);
		message.clear();
		lines.push_back(outputLine);
	}
	return lines;
}
开发者ID:janwilmans,项目名称:DebugViewPP,代码行数:41,代码来源:DBWinReader.cpp

示例11:

Lines
Polyline::lines() const
{
    Lines lines;
    if (this->points.size() >= 2) {
        lines.reserve(this->points.size() - 1);
        for (Points::const_iterator it = this->points.begin(); it != this->points.end()-1; ++it) {
            lines.push_back(Line(*it, *(it + 1)));
        }
    }
    return lines;
}
开发者ID:2bright,项目名称:Slic3r,代码行数:12,代码来源:Polyline.cpp

示例12: GetIntersection

void GetIntersection(Triangle& t1,Triangle& t2,Lines& res,std::vector<LineConf>* lines_conf,float*perimeter)
{
	Line ll;
	LineConf cc;
	if(CrossTriangles(t1,t2,&ll,cc.v))
	{
		if(!vecs_near(ll.v[0],ll.v[1]))
		{
			res.push_back(ll);
			if(lines_conf)lines_conf->push_back(cc);
			if(perimeter)*perimeter += ll.v[0].length(ll.v[1]);
		}//else printf(" BL ");
	}
}
开发者ID:hksonngan,项目名称:astrocytes,代码行数:14,代码来源:highSection.cpp

示例13: Process

Lines NewlineFilter::Process(const Line& line)
{
    Lines lines;
    auto& message = m_lineBuffers[line.pid];
    message.reserve(4000);

    Line outputLine = line;
    for (auto it = line.message.begin(); it != line.message.end(); ++it)
    {
        if (*it == '\r')
            continue;

        if (*it == '\n')
        {
            outputLine.message = message;
            message.clear();
            lines.push_back(outputLine);
        }
        else
        {
            message.push_back(*it);
        }
    }

    if (message.empty())
    {
        m_lineBuffers.erase(line.pid);
    }
    else if (outputLine.pLogSource->GetAutoNewLine() || message.size() > 8192)	// 8k line limit prevents stack overflow in handling code
    {
        outputLine.message = message;
        message.clear();
        lines.push_back(outputLine);
    }
    return lines;
}
开发者ID:JayceM6,项目名称:DebugViewPP,代码行数:36,代码来源:NewlineFilter.cpp

示例14: GetLine

Lines GetLine(CvPoints2d& cvline)
{
	Lines res;

	for (auto it = cvline.begin(); it != cvline.end(); ++it)
	{
		Line li;

		for (auto it2 = it->begin(); it2 != it->end(); ++it2)
		{
			li.push_back(Vector2(it2->x, it2->y));
		}

		res.push_back(li);
	}

	return res;
}
开发者ID:maleiwhat,项目名称:vectorizing-project,代码行数:18,代码来源:Edge.cpp

示例15: open

bool FileHelper::open(const std::string file_name, Lines& lines)
{
    std::ifstream file(file_name.c_str(), std::ios::in);
    if (!file) 
    {
        return false;
    }

    lines.clear();
    char buffer[buffer_size];

    while (file.getline(buffer, buffer_size, '\n'))
    {
        lines.push_back(buffer);
    }
    
    return true;
}
开发者ID:shenglonglinapple,项目名称:slin_code,代码行数:18,代码来源:FileHelper.cpp


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