本文整理汇总了C++中pstring类的典型用法代码示例。如果您正苦于以下问题:C++ pstring类的具体用法?C++ pstring怎么用?C++ pstring使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了pstring类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: verror
ATTR_COLD void parser_t::verror(pstring msg, int line_num, pstring line)
{
m_setup.netlist().error("line %d: error: %s\n\t\t%s\n", line_num,
msg.cstr(), line.cstr());
//throw error;
}
开发者ID:j26w,项目名称:mame,代码行数:7,代码来源:nl_parser.c
示例2: compile
void pfunction::compile(const std::vector<pstring> &inputs, const pstring &expr)
{
if (expr.startsWith("rpn:"))
compile_postfix(inputs, expr.substr(4));
else
compile_infix(inputs, expr);
}
开发者ID:MASHinfo,项目名称:mame,代码行数:7,代码来源:pfunction.cpp
示例3: append_sheet
void orcus_xml::append_sheet(const pstring& name)
{
if (name.empty())
return;
mp_impl->mp_import_factory->append_sheet(name.get(), name.size());
}
开发者ID:Distrotech,项目名称:liborcus,代码行数:7,代码来源:orcus_xml.cpp
示例4:
bool ScriptHandler::LogInfo::find(pstring what)
{
if (what[0] == '*') what.remove(0, 1);
what.toupper();
replace_ascii(what, '/', '\\');
return logged.find(what) != logged.end();
}
开发者ID:dsp2003,项目名称:ponscripter-fork-wh,代码行数:7,代码来源:ScriptHandler.cpp
示例5: fopen
const char *filetobuf(pstring fname)
{
static pstring pbuf = "";
if (fname == "-")
{
char lbuf[1024];
while (!feof(stdin))
{
fgets(lbuf, 1024, stdin);
pbuf += lbuf;
}
printf("%d\n",*(pbuf.right(1).cstr()+1));
return pbuf.cstr();
}
else
{
FILE *f;
f = fopen(fname, "rb");
fseek(f, 0, SEEK_END);
long fsize = ftell(f);
fseek(f, 0, SEEK_SET);
char *buf = (char *) malloc(fsize + 1);
fread(buf, fsize, 1, f);
buf[fsize] = 0;
fclose(f);
return buf;
}
}
开发者ID:ef1105,项目名称:mameplus,代码行数:30,代码来源:nltool.c
示例6: LoadLibrary
pdynlib::pdynlib(const pstring libname)
: m_isLoaded(false), m_lib(nullptr)
{
#ifdef _WIN32
//fprintf(stderr, "win: loading <%s>\n", libname.cstr());
if (libname != "")
m_lib = LoadLibrary(libname.cstr());
else
m_lib = GetModuleHandle(nullptr);
if (m_lib != nullptr)
m_isLoaded = true;
//else
// fprintf(stderr, "win: library <%s> not found!\n", libname.cstr());
#else
//printf("loading <%s>\n", libname.cstr());
if (libname != "")
m_lib = dlopen(libname.cstr(), RTLD_LAZY);
else
m_lib = dlopen(nullptr, RTLD_LAZY);
if (m_lib != nullptr)
m_isLoaded = true;
//else
// printf("library <%s> not found!\n", libname.cstr());
#endif
}
开发者ID:chrisisonwildcode,项目名称:mame,代码行数:25,代码来源:pdynlib.cpp
示例7: characters
void xls_xml_context::characters(const pstring& str, bool transient)
{
if (str.empty())
return;
const xml_token_pair_t& elem = get_current_element();
if (elem.first == NS_xls_xml_ss && elem.second == XML_Data)
{
switch (m_cur_cell_type)
{
case ct_string:
{
if (transient)
m_cur_cell_string.push_back(m_pool.intern(str).first);
else
m_cur_cell_string.push_back(str);
}
break;
case ct_number:
{
const char* p = str.get();
m_cur_cell_value = to_double(p, p + str.size());
}
break;
default:
;
}
}
}
开发者ID:jvsg,项目名称:orcus,代码行数:30,代码来源:xls_xml_context.cpp
示例8: model_value
ATTR_COLD nl_double netlist_param_model_t::model_value(const pstring &entity, const nl_double defval) const
{
pstring tmp = this->Value();
// .model 1N914 D(Is=2.52n Rs=.568 N=1.752 Cjo=4p M=.4 tt=20n Iave=200m Vpk=75 mfg=OnSemi type=silicon)
int p = tmp.ucase().find(entity.ucase() + "=");
if (p>=0)
{
int pblank = tmp.find(" ", p);
if (pblank < 0) pblank = tmp.len() + 1;
tmp = tmp.substr(p, pblank - p);
int pequal = tmp.find("=", 0);
if (pequal < 0)
netlist().error("parameter %s misformat in model %s temp %s\n", entity.cstr(), Value().cstr(), tmp.cstr());
tmp = tmp.substr(pequal+1);
nl_double factor = NL_FCONST(1.0);
switch (*(tmp.right(1).cstr()))
{
case 'm': factor = 1e-3; break;
case 'u': factor = 1e-6; break;
case 'n': factor = 1e-9; break;
case 'p': factor = 1e-12; break;
case 'f': factor = 1e-15; break;
case 'a': factor = 1e-18; break;
}
if (factor != NL_FCONST(1.0))
tmp = tmp.left(tmp.len() - 1);
return (nl_double) atof(tmp.cstr()) * factor;
}
else
{
netlist().log("Entity %s not found in model %s\n", entity.cstr(), tmp.cstr());
return defval;
}
}
开发者ID:vorlenko,项目名称:mame,代码行数:35,代码来源:nl_base.c
示例9: pcat
void pstringbuffer::pcat(const pstring &s)
{
const std::size_t slen = s.blen();
const std::size_t nl = m_len + slen + 1;
resize(nl);
std::copy(s.c_str(), s.c_str() + slen, m_ptr + m_len);
m_len += slen;
m_ptr[m_len] = 0;
}
开发者ID:antonioginer,项目名称:mame,代码行数:9,代码来源:pstring.cpp
示例10: wav_t
wav_t(const pstring &fn, unsigned sr)
{
m_f = std::fopen(fn.cstr(),"w");
if (m_f==NULL)
throw netlist::fatalerror_e("Error opening output file: %s", fn.cstr());
initialize(sr);
std::fwrite(&m_fh, sizeof(m_fh), 1, m_f);
std::fwrite(&m_fmt, sizeof(m_fmt), 1, m_f);
std::fwrite(&m_data, sizeof(m_data), 1, m_f);
}
开发者ID:matthewbauer,项目名称:mame,代码行数:10,代码来源:nlwav.c
示例11: while
double nl_convert_base_t::get_sp_val(const pstring &sin)
{
std::size_t p = 0;
while (p < sin.length() && (m_numberchars.find(sin.substr(p, 1)) != pstring::npos))
++p;
pstring val = sin.left(p);
pstring unit = sin.substr(p);
double ret = get_sp_unit(unit) * val.as_double();
return ret;
}
开发者ID:MASHinfo,项目名称:mame,代码行数:10,代码来源:nl_convert.cpp
示例12: while
double nl_convert_base_t::get_sp_val(const pstring &sin)
{
std::size_t p = 0;
while (p < sin.length() && (m_numberchars.find(sin.substr(p, 1)) != pstring::npos))
++p;
pstring val = plib::left(sin, p);
pstring unit = sin.substr(p);
double ret = get_sp_unit(unit) * plib::pstonum<double, true>(val);
return ret;
}
开发者ID:fesh0r,项目名称:mame-full,代码行数:10,代码来源:nl_convert.cpp
示例13: input_t
input_t(netlist::netlist_t *netlist, const pstring &line)
{
char buf[400];
double t;
int e = sscanf(line.cstr(), "%lf,%[^,],%lf", &t, buf, &m_value);
if ( e!= 3)
throw netlist::fatalerror_e("error %d scanning line %s\n", e, line.cstr());
m_time = netlist::netlist_time::from_double(t);
m_param = netlist->setup().find_param(buf, true);
}
开发者ID:matthewbauer,项目名称:mame,代码行数:10,代码来源:nltool.c
示例14: while
double nl_convert_base_t::get_sp_val(const pstring &sin)
{
int p = sin.len() - 1;
while (p>=0 && (sin.substr(p,1) < "0" || sin.substr(p,1) > "9"))
p--;
pstring val = sin.substr(0,p + 1);
pstring unit = sin.substr(p + 1);
double ret = get_sp_unit(unit) * val.as_double();
return ret;
}
开发者ID:NULUSIOS,项目名称:mame,代码行数:11,代码来源:nl_convert.cpp
示例15: errorAndExit
ScriptHandler::LabelInfo::iterator ScriptHandler::findLabel(pstring label)
{
if (label[0] == '*') label.remove(0, 1);
label.tolower();
LabelInfo::dic::iterator e = label_names.find(label);
if (e != label_names.end())
return e->second;
errorAndExit("Label \"" + label + "\" is not found.");
return label_info.end(); // dummy
}
开发者ID:dsp2003,项目名称:ponscripter-fork-wh,代码行数:12,代码来源:ScriptHandler.cpp
示例16: get_prio
static int get_prio(pstring v)
{
if (v == "(" || v == ")")
return 1;
else if (v.left(1) >= "a" && v.left(1) <= "z")
return 0;
else if (v == "*" || v == "/")
return 20;
else if (v == "+" || v == "-")
return 10;
else if (v == "^")
return 30;
else
return -1;
}
开发者ID:MASHinfo,项目名称:mame,代码行数:15,代码来源:pfunction.cpp
示例17: tokenize
xml_token_t tokenize(const pstring& name) const
{
xml_token_t token = XML_UNKNOWN_TOKEN;
if (!name.empty())
token = m_tokens.get_token(name);
return token;
}
开发者ID:Distrotech,项目名称:liborcus,代码行数:7,代码来源:sax_token_parser.hpp
示例18: file_open_e
pofilestream::pofilestream(const pstring &fname)
: postream(0), m_file(fopen(fname.c_str(), "wb")), m_pos(0), m_actually_close(true), m_filename(fname)
{
if (m_file == nullptr)
throw file_open_e(m_filename);
init();
}
开发者ID:Robbbert,项目名称:store1,代码行数:7,代码来源:pstream.cpp
示例19: vlog
void netlist_tool_t::vlog(const plib::plog_level &l, const pstring &ls) const
{
pstring err = plib::pfmt("{}: {}\n")(l.name())(ls.c_str());
// FIXME: ...
m_app.pout("{}", err);
if (l == plib::plog_level::FATAL)
throw netlist::nl_exception(err);
}
开发者ID:Tauwasser,项目名称:mame,代码行数:8,代码来源:nltool.cpp
示例20: input_t
input_t(netlist::netlist_t *netlist, const pstring &line)
{
char buf[400];
double t;
int e = sscanf(line.cstr(), "%lf,%[^,],%lf", &t, buf, &m_value);
if ( e!= 3)
throw netlist::fatalerror_e(plib::pfmt("error {1} scanning line {2}\n")(e)(line));
m_time = netlist::netlist_time(t);
m_param = netlist->setup().find_param(buf, true);
}
开发者ID:gvsurenderreddy,项目名称:mame,代码行数:10,代码来源:nltool.cpp
注:本文中的pstring类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论