本文整理汇总了C++中StaticString::c_str方法的典型用法代码示例。如果您正苦于以下问题:C++ StaticString::c_str方法的具体用法?C++ StaticString::c_str怎么用?C++ StaticString::c_str使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StaticString
的用法示例。
在下文中一共展示了StaticString::c_str方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: print_flight
void print_flight() {
_tprintf(_T("%s,%04u-%02u-%02u,%02u:%02u,%02u:%02u\n"), name.c_str(),
year, month, day,
takeoff.time.hour, takeoff.time.minute,
landing.time.hour, landing.time.minute);
}
示例2: initBasic
Value::Value(const StaticString& value) {
initBasic(stringValue);
value_.string_ = const_cast<char*>(value.c_str());
}
示例3:
Value::Value ( const StaticString& value )
: type_ ( stringValue )
, allocated_ ( false )
{
value_.string_ = const_cast<char*> ( value.c_str () );
}
示例4: commit
void commit(InputConfig &config, unsigned line) {
if (empty())
return;
TCHAR *token;
// For each mode
token = mode.first_token(_T(" "));
// General errors - these should be true
assert(location < 1024);
const TCHAR *new_label = NULL;
while (token != NULL) {
// All modes are valid at this point
int mode_id = config.MakeMode(token);
assert(mode_id >= 0);
// Make label event
// TODO code: Consider Reuse existing entries...
if (location > 0) {
// Only copy this once per object - save string space
if (!new_label) {
new_label = UnescapeBackslash(label);
}
config.AppendMenu(mode_id, new_label, location, event_id);
}
// Make key (Keyboard input)
// key - Hardware key or keyboard
if (type.equals(_T("key"))) {
// Get the int key (eg: APP1 vs 'a')
unsigned key = ParseKeyCode(data);
if (key > 0) {
unsigned key_code_idx = key;
auto key_2_event = config.Key2Event;
#if defined(ENABLE_SDL) && (SDL_MAJOR_VERSION >= 2)
if (key_code_idx & SDLK_SCANCODE_MASK) {
key_2_event = config.Key2EventNonChar;
key_code_idx &= ~SDLK_SCANCODE_MASK;
}
#endif
key_2_event[mode_id][key_code_idx] = event_id;
} else
LogFormat(_T("Invalid key data: %s at %u"), data.c_str(), line);
// Make gce (Glide Computer Event)
// GCE - Glide Computer Event
} else if (type.equals(_T("gce"))) {
// Get the int key (eg: APP1 vs 'a')
int key = InputEvents::findGCE(data);
if (key >= 0)
config.GC2Event[key] = event_id;
else
LogFormat(_T("Invalid GCE data: %s at %u"), data.c_str(), line);
// Make gesture (Gesture Event)
// Key - Key Event
} else if (type.equals(_T("gesture"))) {
// Check data for invalid characters:
bool valid = true;
for (const TCHAR* c = data; *c; c++)
if (*c != _T('U') &&
*c != _T('D') &&
*c != _T('R') &&
*c != _T('L'))
valid = false;
if (valid) {
// One entry per key: delete old, create new
config.Gesture2Event.Remove(data.c_str());
config.Gesture2Event.Add(data.c_str(), event_id);
} else
LogFormat(_T("Invalid gesture data: %s at %u"), data.c_str(), line);
// Make ne (NMEA Event)
// NE - NMEA Event
} else if (type.equals(_T("ne"))) {
// Get the int key (eg: APP1 vs 'a')
int key = InputEvents::findNE(data);
if (key >= 0)
config.N2Event[key] = event_id;
else
LogFormat(_T("Invalid GCE data: %s at %u"), data.c_str(), line);
// label only - no key associated (label can still be touch screen)
} else if (type.equals(_T("label"))) {
// Nothing to do here...
} else {
LogFormat(_T("Invalid type: %s at %u"), type.c_str(), line);
}
token = mode.next_token(_T(" "));
}
}
示例5: while
//.........这里部分代码省略.........
if (CheckTitle(line, title_length, _T("Dew Point"))) {
StaticString<256> buffer;
if (!parsed.temperatures_available) {
buffer.Format(_T("%s: "), _("Dew Point"));
buffer.append(value, value_length);
} else {
TCHAR temperature_buffer[16];
FormatUserTemperature(parsed.dew_point, temperature_buffer,
ARRAY_SIZE(temperature_buffer));
buffer.Format(_T("%s: %s"), _("Dew Point"), temperature_buffer);
}
output += buffer;
output += '\n';
return true;
}
if (CheckTitle(line, title_length, _T("Pressure (altimeter)"))) {
StaticString<256> buffer;
if (!parsed.qnh_available) {
buffer.Format(_T("%s: "), _("Pressure"));
buffer.append(value, value_length);
} else {
TCHAR qnh_buffer[16];
FormatUserPressure(parsed.qnh, qnh_buffer, ARRAY_SIZE(qnh_buffer));
buffer.Format(_T("%s: %s"), _("Pressure"), qnh_buffer);
}
output += buffer;
output += '\n';
return true;
}
if (CheckTitle(line, title_length, _T("Visibility"))) {
StaticString<256> buffer;
buffer.Format(_T("%s: "), _("Visibility"));
if (!parsed.qnh_available) {
buffer.append(value, value_length);
} else {
TCHAR vis_buffer[32];
if (parsed.visibility >= 9999) {
FormatUserDistanceSmart(fixed(10000),
vis_buffer, ARRAY_SIZE(vis_buffer));
buffer.AppendFormat(_("more than %s"), vis_buffer);
} else {
FormatUserDistanceSmart(fixed(parsed.visibility),
vis_buffer, ARRAY_SIZE(vis_buffer));
buffer += vis_buffer;
}
}
output += buffer;
output += '\n';
return true;
}
if (CheckTitle(line, title_length, _T("Sky conditions"))) {
StaticString<256> buffer;
buffer.Format(_T("%s: "), _("Sky Conditions"));
StaticString<64> _value;
_value.set(value, value_length);
buffer += gettext(_value);
output += buffer;
output += '\n';
return true;
}
if (CheckTitle(line, title_length, _T("Weather"))) {
StaticString<256> buffer;
buffer.Format(_T("%s: "), _("Weather"));
StaticString<64> _value;
_value.set(value, value_length);
buffer += gettext(_value);
output += buffer;
output += '\n';
return true;
}
StaticString<64> title;
title.set(line, title_length);
StaticString<256> buffer;
buffer.Format(_T("%s: "), gettext(title.c_str()));
buffer.append(value, value_length);
output += buffer;
output += '\n';
return true;
}
示例6:
/**
* Returns the Caption/Text of the Control
* @return The Caption/Text of the Control
*/
const TCHAR *GetCaption() const {
return mCaption.c_str();
}
示例7:
const TCHAR *GetCaption() const {
return text.c_str();
}
示例8:
/**
* Returns the temporary path. This is the path that shall be used
* by the caller to write the file.
*/
const TCHAR *GetTemporaryPath() const {
return temporary_path.c_str();
}