本文整理汇总了C++中pstring函数的典型用法代码示例。如果您正苦于以下问题:C++ pstring函数的具体用法?C++ pstring怎么用?C++ pstring使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pstring函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: get_cell_buffer
void sax_parser<_Handler,_Config>::characters()
{
size_t first = m_pos;
const char* p0 = m_char;
for (; has_char(); next())
{
if (cur_char() == '<')
break;
if (cur_char() == '&')
{
// Text span with one or more encoded characters. Parse using cell buffer.
cell_buffer& buf = get_cell_buffer();
buf.reset();
buf.append(p0, m_pos-first);
characters_with_encoded_char(buf);
if (buf.empty())
m_handler.characters(pstring(), false);
else
m_handler.characters(pstring(buf.get(), buf.size()), true);
return;
}
}
if (m_pos > first)
{
size_t size = m_pos - first;
pstring val(m_content + first, size);
m_handler.characters(val, false);
}
}
开发者ID:Distrotech,项目名称:liborcus,代码行数:31,代码来源:sax_parser.hpp
示例2: opt_tabwidth
void tool_app_t::mac_out(const pstring &s, const bool cont)
{
if (cont)
{
unsigned pos = 0;
pstring r;
for (const auto &x : s)
{
if (x == '\t')
{
auto pos_mod_4 = pos % opt_tabwidth();
auto tab_adj = opt_tabwidth() - pos_mod_4;
r += plib::rpad(pstring(""), pstring(" "), tab_adj);
pos += tab_adj;
}
else
{
r += x;
pos++;
}
}
pout("{1}\\\n", plib::rpad(r, pstring(" "), opt_linewidth()-1));
}
else
pout("{1}\n", s);
}
开发者ID:fesh0r,项目名称:mame-full,代码行数:26,代码来源:nltool.cpp
示例3: string
IShapeMap *IGraphFile::importMap(const char *filename, const char *type, const char *newmapname)
{
// Note: 08-APR-2010 -- still have to add DXF and CAT (all to get automatic analysis working)
IShapeMap *shapemap = NULL;
MetaGraph *graph = ((IGraphOrganizer *)m_data)->m_graph;
string type_str = string(type);
if (!(type_str.compare("MIF") == 0 || type_str.compare("TXT") == 0 || type_str.compare("CSV") == 0)) {
return NULL;
}
if (type_str.compare("TXT") == 0 || type_str.compare("CSV") == 0)
{
// these can be x,y points or x1,y1,x2,y2 lines
// first line should be labels, creates a datamap
ifstream file(filename);
if (!file) {
return NULL;
}
else {
int mapref = graph->importTxt( file, pstring(newmapname), (type_str.compare("CSV")==0) );
if (mapref != -1) {
// note, at this stage in development, you CANNOT go from the mapref directly here as the getIShapeMap has both shape graphs and data maps mixed together
ShapeMap& basemap = graph->m_data_maps.getMap(mapref);
shapemap = ((IGraphOrganizer *)m_data)->getIShapeMap(&basemap);
}
}
}
else if (type_str.compare("MIF") == 0) {
pstring miffilename = pstring(filename) + ".mif";
pstring midfilename = pstring(filename) + ".mid";
ifstream miffile( miffilename.c_str() );
ifstream midfile( midfilename.c_str() );
if (miffile && midfile) {
int mapref = graph->m_data_maps.addMap(pstring(newmapname),ShapeMap::DATAMAP);
ShapeMap& mifmap = graph->m_data_maps.getMap(mapref);
int ok = mifmap.loadMifMap(miffile,midfile);
if (ok == MINFO_OK || ok == MINFO_MULTIPLE) { // multiple is just a warning
// note, at this stage in development, you CANNOT go from the mapref directly here as the getIShapeMap has both shape graphs and data maps mixed together
shapemap = ((IGraphOrganizer *)m_data)->getIShapeMap(&mifmap);
}
else { // error: undo!
graph->m_data_maps.removeMap(mapref);
}
}
}
return shapemap;
}
开发者ID:SZ-whf,项目名称:Depthmap,代码行数:59,代码来源:idepthmap.cpp
示例4: addPrefix
void addPrefix(char* startbuf, int n) {
std::set<pstring>::iterator elem = pset.find(pstring(startbuf, n));
bool replace = elem != pset.end() && n < elem->n;
if (replace) {
pset.erase(elem);
}
if (replace || elem == pset.end()) {
pset.insert(pstring(startbuf, n));
}
}
开发者ID:Hsaniva,项目名称:apitrace,代码行数:10,代码来源:trace_backtrace.cpp
示例5: pstring
pstring document::get_sheet_name(sheet_t sheet_pos) const
{
if (sheet_pos < 0)
return pstring();
size_t pos = static_cast<size_t>(sheet_pos);
if (pos >= mp_impl->m_sheets.size())
return pstring();
return mp_impl->m_sheets[pos].name;
}
开发者ID:CarterWeron,项目名称:liborcus,代码行数:11,代码来源:document.cpp
示例6: while
double nl_convert_base_t::get_sp_unit(const pstring &unit)
{
int i = 0;
while (pstring(m_units[i].m_unit, pstring::UTF8) != "-")
{
if (pstring(m_units[i].m_unit, pstring::UTF8) == unit)
return m_units[i].m_mult;
i++;
}
fprintf(stderr, "Unit %s unknown\n", unit.c_str());
return 0.0;
}
开发者ID:MASHinfo,项目名称:mame,代码行数:12,代码来源:nl_convert.cpp
示例7: insertAttributeColumn
bool IAttributes::insertAttributeColumn(const char *attribute)
{
if (strcmp(attribute,"Ref Number") != 0) {
AttributeTable *table = (AttributeTable *)m_data;
int n = table->getColumnIndex(pstring(attribute));
if (n == -1 || !table->isColumnLocked(n)) {
table->insertColumn(pstring(attribute));
return true;
}
}
return false;
}
开发者ID:SZ-whf,项目名称:Depthmap,代码行数:12,代码来源:idepthmap.cpp
示例8: while
double nl_convert_base_t::get_sp_unit(const pstring &unit)
{
int i = 0;
while (pstring(m_units[i].m_unit) != "-")
{
if (pstring(m_units[i].m_unit) == unit)
return m_units[i].m_mult;
i++;
}
plib::perrlogger("Unit {} unknown\n", unit);
return 0.0;
}
开发者ID:fesh0r,项目名称:mame-full,代码行数:12,代码来源:nl_convert.cpp
示例9: MetaGraph
IGraphFile *newGraphFile()
{
IGraphFile *graphfile = NULL;
MetaGraph *graph = new MetaGraph();
// REMINDER: fill in some more details here:
pstring version = "Sala.dll version";
char tmpbuf[9];
pstring date = pstring(_strdate(tmpbuf));
graph->setProperties(pstring("Name"),pstring("Organisation"),pstring(date),pstring(version));
graphfile = new IGraphFile();
graphfile->setData(graph);
// ensure the graph is labelled for deletion after use
((IGraphOrganizer *)graphfile->m_data)->setDeleteFlag();
return graphfile;
}
开发者ID:SZ-whf,项目名称:Depthmap,代码行数:15,代码来源:idepthmap.cpp
示例10: xml_context_base
opc_relations_context::opc_relations_context(session_context& session_cxt, const tokens &_tokens) :
xml_context_base(session_cxt, _tokens)
{
// build content type cache.
for (schema_t* p = SCH_all; *p; ++p)
m_schema_cache.insert(pstring(*p));
}
开发者ID:CarterWeron,项目名称:liborcus,代码行数:7,代码来源:opc_context.cpp
示例11: remains
void sax_parser<_Handler,_Config>::cdata()
{
size_t len = remains();
assert(len > 3);
// Parse until we reach ']]>'.
const char* p0 = m_char;
size_t i = 0, match = 0;
for (char c = cur_char(); i < len; ++i, c = next_char())
{
if (c == ']')
{
// Be aware that we may encounter a series of more than two ']'
// characters, in which case we'll only count the last two.
if (match == 0)
// First ']'
++match;
else if (match == 1)
// Second ']'
++match;
}
else if (c == '>' && match == 2)
{
// Found ']]>'.
size_t cdata_len = i - 2;
m_handler.characters(pstring(p0, cdata_len), false);
next();
return;
}
else
match = 0;
}
throw sax::malformed_xml_error("malformed CDATA section.");
}
开发者ID:Distrotech,项目名称:liborcus,代码行数:35,代码来源:sax_parser.hpp
示例12: cur_char
bool parser_base::value(pstring& str, bool decode)
{
char c = cur_char();
if (c != '"')
throw malformed_xml_error("value must be quoted");
c = next_char_checked();
size_t first = m_pos;
const char* p0 = m_char;
for (; c != '"'; c = next_char_checked())
{
if (decode && c == '&')
{
// This value contains one or more encoded characters.
cell_buffer& buf = get_cell_buffer();
buf.reset();
buf.append(p0, m_pos-first);
value_with_encoded_char(buf, str);
return true;
}
}
str = pstring(p0, m_pos-first);
// Skip the closing quote.
next();
return false;
}
开发者ID:CarterWeron,项目名称:liborcus,代码行数:30,代码来源:sax_parser_base.cpp
示例13: va_start
pstring pstring::sprintf(const char *format, ...)
{
va_list ap;
va_start(ap, format);
pstring ret = pstring(format).vprintf(ap);
va_end(ap);
return ret;
}
开发者ID:Ander-son,项目名称:libretro-mame,代码行数:8,代码来源:pstring.c
示例14: vsprintf
pstring pstring::vprintf(va_list args) const
{
// sprintf into the temporary buffer
char tempbuf[4096];
vsprintf(tempbuf, cstr(), args);
return pstring(tempbuf);
}
开发者ID:Ander-son,项目名称:libretro-mame,代码行数:8,代码来源:pstring.c
示例15: getAttribute
// get an attribute from the attribute table for the current point:
float IAttributes::getAttribute(int id, const char *attribute)
{
AttributeTable& table = *((AttributeTable *)m_data);
int index = (m_analysis_type != DLL_VGA_ANALYSIS) ? id : table.getRowid(id); // vga needs to look up rowid, all others use rowid directly
if (index == -1) {
return -1.0f;
}
return table.getValue(index,pstring(attribute));
}
开发者ID:SZ-whf,项目名称:Depthmap,代码行数:10,代码来源:idepthmap.cpp
示例16: nt
void tool_app_t::create_header()
{
netlist_tool_t nt(*this, "netlist");
nt.init();
nt.log().verbose.set_enabled(false);
nt.log().warning.set_enabled(false);
nt.setup().register_source(plib::make_unique_base<netlist::source_t,
netlist::source_proc_t>(nt.setup(), "dummy", &netlist_dummy));
nt.setup().include("dummy");
pout("// license:GPL-2.0+\n");
pout("// copyright-holders:Couriersud\n");
pout("#ifndef NLD_DEVINC_H\n");
pout("#define NLD_DEVINC_H\n");
pout("\n");
pout("#include \"nl_setup.h\"\n");
pout("#ifndef __PLIB_PREPROCESSOR__\n");
pout("\n");
pout("/* ----------------------------------------------------------------------------\n");
pout(" * Netlist Macros\n");
pout(" * ---------------------------------------------------------------------------*/\n");
pout("\n");
pstring last_source("");
for (auto &e : nt.setup().factory())
{
if (last_source != e->sourcefile())
{
last_source = e->sourcefile();
pout("{1}\n", pstring("// ").rpad("-", 72));
pout("{1}{2}\n", pstring("// Source: "), e->sourcefile().replace_all("../", ""));
pout("{1}\n", pstring("// ").rpad("-", 72));
}
cmac(e.get());
}
pout("#endif // __PLIB_PREPROCESSOR__\n");
pout("#endif\n");
nt.stop();
}
开发者ID:Tauwasser,项目名称:mame,代码行数:44,代码来源:nltool.cpp
示例17: renameAttributeColumn
bool IAttributes::renameAttributeColumn(const char *oldname, const char *newname)
{
AttributeTable *table = (AttributeTable *)m_data;
int n = table->getColumnIndex(pstring(oldname));
if (n != -1 && !table->isColumnLocked(n)) {
table->renameColumn(n,newname);
return true;
}
return false;
}
开发者ID:SZ-whf,项目名称:Depthmap,代码行数:10,代码来源:idepthmap.cpp
示例18: isLockedAttributeColumn
bool IAttributes::isLockedAttributeColumn(const char *attribute)
{
AttributeTable *table = (AttributeTable *)m_data;
int n = table->getColumnIndex(pstring(attribute));
if (n != -1 && !table->isColumnLocked(n)) {
return table->isColumnLocked(n);
}
// n.b., this should really throw an exception:
return false;
}
开发者ID:SZ-whf,项目名称:Depthmap,代码行数:10,代码来源:idepthmap.cpp
示例19: catremainder
static pstring catremainder(const pstring_list_t &elems, std::size_t start, pstring sep)
{
pstringbuffer ret = "";
for (std::size_t i=start; i<elems.size(); i++)
{
ret.cat(elems[i]);
ret.cat(sep);
}
return pstring(ret.cstr());
}
开发者ID:richard42,项目名称:mame,代码行数:10,代码来源:pparser.c
示例20: while
pstring ptokenizer::currentline_str()
{
char buf[300];
int bufp = 0;
const char *p = m_line_ptr;
while (*p && *p != 10)
buf[bufp++] = *p++;
buf[bufp] = 0;
return pstring(buf);
}
开发者ID:richard42,项目名称:mame,代码行数:10,代码来源:pparser.c
注:本文中的pstring函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论