本文整理汇总了C++中StaticString::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ StaticString::clear方法的具体用法?C++ StaticString::clear怎么用?C++ StaticString::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StaticString
的用法示例。
在下文中一共展示了StaticString::clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Clear
void Clear() {
port_type = DISABLED;
baud_rate = 4800u;
path.clear();
bluetooth_mac.clear();
driver_name.clear();
}
示例2: Set
void Set(const TCHAR *_name, const DownloadStatus *_download_status,
bool _failed) {
name = _name;
TCHAR path[MAX_PATH];
LocalPath(path, name);
if (File::Exists(path)) {
FormatByteSize(size.buffer(), size.MAX_SIZE,
File::GetSize(path));
#ifdef HAVE_POSIX
FormatISO8601(last_modified.buffer(),
BrokenDateTime::FromUnixTimeUTC(File::GetLastModification(path)));
#else
// XXX implement
last_modified.clear();
#endif
} else {
size.clear();
last_modified.clear();
}
downloading = _download_status != NULL;
if (downloading)
download_status = *_download_status;
failed = _failed;
}
示例3: AddReadOnly
void
ManageV7Widget::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
StaticString<64> buffer;
if (!info.product.empty()) {
buffer.clear();
buffer.UnsafeAppendASCII(info.product.c_str());
AddReadOnly(_("Product"), NULL, buffer.c_str());
}
if (!info.serial.empty()) {
buffer.clear();
buffer.UnsafeAppendASCII(info.serial.c_str());
AddReadOnly(_("Serial"), NULL, buffer.c_str());
}
if (!info.hardware_version.empty()) {
buffer.clear();
buffer.UnsafeAppendASCII(info.hardware_version.c_str());
AddReadOnly(_("Hardware version"), NULL, buffer.c_str());
}
if (!info.software_version.empty()) {
buffer.clear();
buffer.UnsafeAppendASCII(info.software_version.c_str());
AddReadOnly(_("Firmware version"), NULL, buffer.c_str());
}
AddButton(_("Setup"), this, SETUP);
}
示例4: if
inline void
WifiListWidget::Connect()
{
if (!EnsureConnected()) {
ShowMessageBox(_T("Network failure"), _("Connect"), MB_OK);
return;
}
const unsigned i = GetList().GetCursorIndex();
if (i >= networks.size())
return;
const auto &info = networks[i];
if (info.id < 0) {
const auto ssid = info.ssid;
StaticString<256> caption;
caption.Format(_("Passphrase of network '%s'"), ssid.c_str());
StaticString<32> passphrase;
passphrase.clear();
if (info.security == OPEN_SECURITY)
passphrase.clear();
else if (!TextEntryDialog(passphrase, caption, false))
return;
if (!WifiConnect(info.security, wpa_supplicant, info.ssid, passphrase))
ShowMessageBox(_T("Network failure"), _("Connect"), MB_OK);
} else {
if (!wpa_supplicant.RemoveNetwork(info.id) || !wpa_supplicant.SaveConfig())
ShowMessageBox(_T("Error"), _("Remove"), MB_OK);
}
UpdateList();
}
示例5: clear
void clear() {
event_id = 0;
location = 0;
mode.clear();
type.clear();
data.clear();
label.clear();
}
示例6: free
static void
LoadChecklist()
{
nLists = 0;
free(ChecklistText[0]);
ChecklistText[0] = NULL;
free(ChecklistTitle[0]);
ChecklistTitle[0] = NULL;
TLineReader *reader = OpenDataTextFile(_T(XCSCHKLIST));
if (reader == NULL) {
addChecklist(_("No checklist loaded"), _("Create xcsoar-checklist.txt"));
return;
}
StaticString<MAXDETAILS> Details;
TCHAR Name[100];
bool inDetails = false;
int i;
Details.clear();
Name[0] = 0;
TCHAR *TempString;
while ((TempString = reader->ReadLine()) != NULL) {
// Look for start
if (TempString[0] == '[') {
if (inDetails) {
addChecklist(Name, Details);
Details.clear();
Name[0] = 0;
}
// extract name
for (i = 1; i < MAXTITLE; i++) {
if (TempString[i] == ']')
break;
Name[i - 1] = TempString[i];
}
Name[i - 1] = 0;
inDetails = true;
} else {
// append text to details string
Details.append(TempString);
Details.Append(_T('\n'));
}
}
delete reader;
if (inDetails) {
addChecklist(Name, Details);
}
}
示例7: LoadFlarmDatabases
void
InputEvents::eventFlarmDetails(gcc_unused const TCHAR *misc)
{
LoadFlarmDatabases();
StaticString<4> callsign;
callsign.clear();
if (!TextEntryDialog(CommonInterface::main_window, callsign,
_("Competition ID")) ||
callsign.empty())
return;
FlarmId ids[30];
unsigned count = FlarmDetails::FindIdsByCallSign(callsign, ids, 30);
if (count > 0) {
FlarmId id = dlgFlarmDetailsListShowModal(
XCSoarInterface::main_window, _("Show details:"), ids, count);
if (id.IsDefined())
dlgFlarmTrafficDetailsShowModal(id);
} else {
ShowMessageBox(_("Unknown competition number"),
_("Not found"), MB_OK | MB_ICONINFORMATION);
}
}
示例8: Clear
void Clear() {
port_type = PortType::DISABLED;
baud_rate = 4800u;
bulk_baud_rate = 0u;
network_port = 4353u;
path.clear();
bluetooth_mac.clear();
driver_name.clear();
sync_from_device = true;
sync_to_device = true;
k6bt = false;
#ifndef NDEBUG
dump_port = false;
#endif
ignore_checksum = false;
}
示例9: tstring
const tstring
AirspaceAltitude::GetAsTextUnits(const bool concise) const
{
StaticString<64> buffer;
switch (type) {
case AGL:
if (!positive(altitude_above_terrain))
buffer = _T("GND");
else
buffer.Format(_T("%d %s AGL"),
iround(Units::ToUserAltitude(altitude_above_terrain)),
Units::GetAltitudeName());
break;
case FL:
buffer.Format(_T("FL%d"), (int)flight_level);
break;
case MSL:
buffer.Format(_T("%d %s"), iround(Units::ToUserAltitude(altitude)),
Units::GetAltitudeName());
break;
case UNDEFINED:
default:
buffer.clear();
break;
}
if (!concise && type != MSL && positive(altitude))
buffer.AppendFormat(_T(" %d %s"), iround(Units::ToUserAltitude(altitude)),
Units::GetAltitudeName());
return tstring(buffer);
}
示例10: AddBoolean
void
TrackingConfigPanel::Prepare(ContainerWindow &parent, const PixelRect &rc)
{
const TrackingSettings &settings =
CommonInterface::GetComputerSettings().tracking;
RowFormWidget::Prepare(parent, rc);
#ifdef HAVE_SKYLINES_TRACKING
AddBoolean(_T("SkyLines"), NULL, settings.skylines.enabled, this);
AddTime(_("Tracking Interval"), NULL, 5, 1200, 5,
settings.skylines.interval);
#ifdef HAVE_SKYLINES_TRACKING_HANDLER
AddBoolean(_("Track friends"),
_("Download the position of your friends live from the SkyLines server."),
settings.skylines.traffic_enabled, this);
#endif
StaticString<64> buffer;
if (settings.skylines.key != 0)
buffer.UnsafeFormat(_T("%llX"), (unsigned long long)settings.skylines.key);
else
buffer.clear();
AddText(_T("Key"), NULL, buffer);
#endif
#if defined(HAVE_SKYLINES_TRACKING) && defined(HAVE_LIVETRACK24)
AddSpacer();
#endif
#ifdef HAVE_LIVETRACK24
AddBoolean(_T("LiveTrack24"), _T(""), settings.livetrack24.enabled, this);
AddTime(_("Tracking Interval"), _T(""), 5, 3600, 5, settings.interval);
AddEnum(_("Vehicle Type"), _("Type of vehicle used."), vehicle_type_list,
(unsigned) settings.vehicleType);
WndProperty *edit = AddEnum(_("Server"), _T(""), server_list, 0);
((DataFieldEnum *)edit->GetDataField())->Set(settings.livetrack24.server);
edit->RefreshDisplay();
AddText(_("Username"), _T(""), settings.livetrack24.username);
AddPassword(_("Password"), _T(""), settings.livetrack24.password);
#endif
#ifdef HAVE_SKYLINES_TRACKING
SetSkyLinesEnabled(settings.skylines.enabled);
#endif
#ifdef HAVE_LIVETRACK24
SetEnabled(settings.livetrack24.enabled);
#endif
}
示例11: SaveFlarmNames
/**
* This event handler is called when the "Change Callsign" button is pressed
*/
inline void
FlarmTrafficDetailsWidget::OnCallsignClicked()
{
StaticString<21> newName;
newName.clear();
if (TextEntryDialog(newName, _("Competition ID")) &&
FlarmDetails::AddSecondaryItem(target_id, newName))
SaveFlarmNames();
Update();
}
示例12: Update
/**
* This event handler is called when the "Change Callsign" button is pressed
*/
static void
OnCallsignClicked(gcc_unused WndButton &Sender)
{
StaticString<21> newName;
newName.clear();
if (TextEntryDialog(XCSoarInterface::main_window, newName,
_("Competition ID")) &&
FlarmDetails::AddSecondaryItem(target_id, newName))
FlarmDetails::SaveSecondary();
Update();
}
示例13: Item
explicit Item(uint32_t _id, uint32_t _time_of_day_ms,
const GeoPoint &_location, int _altitude,
std::string &&_name)
:id(FlarmId::Undefined()), skylines_id(_id),
time_of_day_ms(_time_of_day_ms),
color(FlarmColor::COUNT),
loaded(false),
location(_location),
vector(GeoVector::Invalid()), name(std::move(_name)),
altitude(_altitude) {
assert(IsSkyLines());
near_name.clear();
}
示例14: lease
static void
UpdateNameButton()
{
StaticString<80u> buffer;
{
ProtectedTaskManager::Lease lease(*protected_task_manager);
const OrderedTask &task = lease->GetOrderedTask();
if (target_point < task.TaskSize()) {
const OrderedTaskPoint &tp = task.GetTaskPoint(target_point);
buffer.Format(_T("%u: %s"), target_point,
tp.GetWaypoint().name.c_str());
} else
buffer.clear();
}
WndButton &name_button = *(WndButton *)wf->FindByName(_T("Name"));
name_button.SetText(buffer);
}
示例15: LocalPath
inline void
ProfileListWidget::NewClicked()
{
StaticString<64> name;
name.clear();
if (!TextEntryDialog(name, _("Profile name")))
return;
StaticString<80> filename;
filename = name;
filename += _T(".prf");
StaticString<MAX_PATH> path;
LocalPath(path.buffer(), filename);
if (!File::CreateExclusive(path)) {
ShowMessageBox(name, _("File exists already."), MB_OK|MB_ICONEXCLAMATION);
return;
}
UpdateList();
SelectPath(path);
}