本文整理汇总了C++中NamedString::c_str方法的典型用法代码示例。如果您正苦于以下问题:C++ NamedString::c_str方法的具体用法?C++ NamedString::c_str怎么用?C++ NamedString::c_str使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NamedString
的用法示例。
在下文中一共展示了NamedString::c_str方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fillParam
void CallInfo::fillParam(NamedList& target, const String& name, bool clear)
{
NamedString* param = getParam(name);
if (param)
target.setParam(name,param->c_str());
else if (clear)
target.clearParam(name);
}
示例2: fillParams
void CallInfo::fillParams(NamedList& target)
{
unsigned int n = length();
for (unsigned int i = 0; i < n; i++) {
NamedString* param = getParam(i);
if (param)
target.setParam(param->name(),param->c_str());
}
}
示例3: copyParam
bool CallInfo::copyParam(const NamedList& original, const String& name, bool clear)
{
NamedString* param = original.getParam(name);
if (param) {
setParam(name,param->c_str());
return true;
}
else if (clear)
clearParam(name);
return false;
}
示例4: appendParam
// Append a parameter to a buffer
// Truncate it or set error if fail is true and parameter length exceeds maxLen
// Return: 0 if the parameter is missing
// -1 if the parameter is too long
// 1 on success
int appendParam(ObjList& msg, NamedList& params, unsigned char value,
unsigned char maxLen, bool fail)
{
NamedString* ns = params.getParam(lookup(value,ETSIModem::s_msgParams));
if (!ns)
return 0;
unsigned char len = ns->length();
if (len > maxLen) {
if (fail) {
params.setParam("error",ns->name() + "-too-long");
return -1;
}
len = maxLen;
}
DataBlock* data = new DataBlock;
unsigned char a[2] = {value,len};
FSKModem::addRaw(*data,a,sizeof(a));
FSKModem::addRaw(*data,(void*)ns->c_str(),len);
msg.append(data);
return 1;
}