本文整理汇总了C++中StringIsEmpty函数的典型用法代码示例。如果您正苦于以下问题:C++ StringIsEmpty函数的具体用法?C++ StringIsEmpty怎么用?C++ StringIsEmpty使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了StringIsEmpty函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadLanguageFile
/**
* Reads the selected LanguageFile into the cache
*/
void
ReadLanguageFile()
{
CloseLanguageFile();
LogStartUp(_T("Loading language file"));
TCHAR buffer[MAX_PATH], second_buffer[MAX_PATH];
const TCHAR *value = Profile::GetPath(ProfileKeys::LanguageFile, buffer)
? buffer : _T("");
if (_tcscmp(value, _T("none")) == 0)
return;
if (StringIsEmpty(value) || _tcscmp(value, _T("auto")) == 0) {
AutoDetectLanguage();
return;
}
const TCHAR *base = BaseName(value);
if (base == NULL)
base = value;
if (base == value) {
LocalPath(second_buffer, value);
value = second_buffer;
}
if (!LoadLanguageFile(value) && !ReadResourceLanguageFile(base))
AutoDetectLanguage();
}
示例2: assert
void
TrafficListWidget::UpdateList()
{
assert(filter_widget != nullptr);
items.clear();
last_update.Clear();
const TCHAR *callsign = filter_widget->GetValueString(CALLSIGN);
if (!StringIsEmpty(callsign)) {
FlarmId ids[30];
unsigned count = FlarmDetails::FindIdsByCallSign(callsign, ids, 30);
for (unsigned i = 0; i < count; ++i)
AddItem(ids[i]);
} else {
/* if no filter was set, show a list of current traffic and known
traffic */
/* add live FLARM traffic */
for (const auto &i : CommonInterface::Basic().flarm.traffic.list) {
AddItem(i.id);
}
/* add FLARM peers that have a user-defined color */
for (const auto &i : traffic_databases->flarm_colors) {
Item &item = AddItem(i.first);
item.color = i.second;
}
/* add FLARM peers that have a user-defined name */
for (const auto &i : traffic_databases->flarm_names) {
AddItem(i.id);
}
#ifdef HAVE_SKYLINES_TRACKING_HANDLER
/* show SkyLines traffic unless this is a FLARM traffic picker
dialog (from dlgTeamCode) */
if (action_listener == nullptr) {
const auto &data = tracking->GetSkyLinesData();
const ScopeLock protect(data.mutex);
for (const auto &i : data.traffic) {
items.emplace_back(i.first, i.second.location);
Item &item = items.back();
if (i.second.location.IsValid() &&
CommonInterface::Basic().location_available)
item.vector = GeoVector(CommonInterface::Basic().location,
i.second.location);
}
}
#endif
}
GetList().SetLength(items.size());
UpdateVolatile();
UpdateButtons();
}
示例3:
const TCHAR *
PrefixDataField::GetAsDisplayString() const
{
const TCHAR *s = DataFieldString::GetAsDisplayString();
if (StringIsEmpty(s))
s = _T("*");
return s;
}
示例4: GetV3key
/*********************************************************************
Get the V3_KEY In order to save it
*********************************************************************/
bool GetV3key()
{
memset(&v3key, 0, sizeof(v3key));
if(Form_V3KEY->CheckBox_SaveV3->Checked)
{
if(!StringIsEmpty(Form_V3KEY->Edit1->Text, 2)
|| !StringIsEmpty(Form_V3KEY->Edit2->Text, 2)
|| !StringIsEmpty(Form_V3KEY->Edit3->Text, 32)
|| !StringIsEmpty(Form_V3KEY->Edit4->Text, 32)
|| !StringIsEmpty(Form_V3KEY->Edit5->Text, 32)
|| !StringIsEmpty(Form_V3KEY->Edit6->Text, 32)
|| !StringIsEmpty(Form_V3KEY->Edit7->Text, 32))
{
return false;
}
sprintf(v3key.itemname, "V3KEY");
v3key.bSave[0] = '1';
//if(Form_V3KEY->Edit_Manufactur->Text)
strcpy(v3key.manufactur, Form_V3KEY->Edit1->Text.c_str());
strcpy(v3key.version, Form_V3KEY->Edit2->Text.c_str());
strcpy(v3key.key_value[0], Form_V3KEY->Edit3->Text.c_str());
strcpy(v3key.key_value[1], Form_V3KEY->Edit4->Text.c_str());
strcpy(v3key.key_value[2], Form_V3KEY->Edit5->Text.c_str());
strcpy(v3key.key_value[3], Form_V3KEY->Edit6->Text.c_str());
strcpy(v3key.key_value[4], Form_V3KEY->Edit7->Text.c_str());
return true;
}
return false;
}
示例5: LogFormat
void
Profile::LoadFile(const TCHAR *szFile)
{
if (StringIsEmpty(szFile))
return;
if (LoadFile(map, szFile))
LogFormat(_T("Loaded profile from %s"), szFile);
}
示例6:
void
NmeaReplay::SetFilename(const TCHAR *name)
{
if (!name || StringIsEmpty(name))
return;
if (_tcscmp(file_name, name) != 0)
_tcscpy(file_name, name);
}
示例7: assert
bool
LiveTrack24::Client::GenerateSessionID(const TCHAR *_username, const TCHAR *_password,
OperationEnvironment &env)
{
// http://www.livetrack24.com/client.php?op=login&user=<username>&pass=<pass>
assert(_username != NULL);
assert(!StringIsEmpty(_username));
assert(_password != NULL);
assert(!StringIsEmpty(_password));
const WideToUTF8Converter username2(_username);
const WideToUTF8Converter password2(_password);
if (!username2.IsValid() || !password2.IsValid())
return false;
NarrowString<1024> url;
url.Format("http://%s/client.php?op=login&user=%s&pass=%s",
(const char *)server, (const char *)username2, (const char *)_password);
// Open download session
Net::Session session;
// Request the file
char buffer[1024];
size_t size = Net::DownloadToBuffer(session, url, buffer, sizeof(buffer) - 1,
env);
if (size == 0 || size == size_t(-1))
return false;
buffer[size] = 0;
char *p_end;
UserID user_id = strtoul(buffer, &p_end, 10);
if (buffer == p_end) {
return false;
}
username.SetASCII(_username);
password.SetASCII(_password);
session_id = RandomSessionID();
session_id |= (user_id & 0x00ffffff);
return true;
}
示例8: assert
void
TaskEditPanel::OnPaintItem(Canvas &canvas, const PixelRect rc,
unsigned DrawListIndex)
{
assert(DrawListIndex <= ordered_task->TaskSize());
const unsigned padding = Layout::GetTextPadding();
const unsigned line_height = rc.bottom - rc.top;
TCHAR buffer[120];
// Draw "Add turnpoint" label
if (DrawListIndex == ordered_task->TaskSize()) {
row_renderer.DrawFirstRow(canvas, rc, _("Add Turnpoint"));
return;
}
const OrderedTaskPoint &tp = ordered_task->GetTaskPoint(DrawListIndex);
GeoVector leg = tp.GetNominalLegVector();
bool show_leg_info = leg.distance > fixed(0.01);
PixelRect text_rc = rc;
text_rc.left += line_height + padding;
if (show_leg_info) {
// Draw leg distance
FormatUserDistanceSmart(leg.distance, buffer, true);
const int x1 = row_renderer.DrawRightFirstRow(canvas, rc, buffer);
// Draw leg bearing
FormatBearing(buffer, ARRAY_SIZE(buffer), leg.bearing);
const int x2 = row_renderer.DrawRightSecondRow(canvas, rc, buffer);
text_rc.right = std::min(x1, x2);
}
// Draw details line
OrderedTaskPointRadiusLabel(tp.GetObservationZone(), buffer);
if (!StringIsEmpty(buffer))
row_renderer.DrawSecondRow(canvas, text_rc, buffer);
// Draw turnpoint name
OrderedTaskPointLabel(tp.GetType(), tp.GetWaypoint().name.c_str(),
DrawListIndex, buffer);
row_renderer.DrawFirstRow(canvas, text_rc, buffer);
// Draw icon
const RasterPoint pt(rc.left + line_height / 2,
rc.top + line_height / 2);
const unsigned radius = line_height / 2 - padding;
OZPreviewRenderer::Draw(canvas, tp.GetObservationZone(),
pt, radius, task_look,
CommonInterface::GetMapSettings().airspace,
airspace_look);
}
示例9: assert
unsigned
FlarmDetails::FindIdsByCallSign(const TCHAR *cn, FlarmId array[],
unsigned size)
{
assert(cn != NULL);
assert(!StringIsEmpty(cn));
assert(traffic_databases != nullptr);
return traffic_databases->FindIdsByName(cn, array, size);
}
示例10:
void
WPASupplicant::Close()
{
if (!StringIsEmpty(local_path)) {
File::Delete(local_path);
local_path[0] = 0;
}
fd.Close();
}
示例11:
// TaskSave
// Saves the task to the specified filename
void
InputEvents::eventTaskSave(const TCHAR *misc)
{
if (protected_task_manager == NULL)
return;
if (!StringIsEmpty(misc)) {
protected_task_manager->TaskSave(LocalPath(misc));
}
}
示例12: zuluCryptGetLoopDeviceAddress
char * zuluCryptGetLoopDeviceAddress( const char * device )
{
char * z = NULL ;
const char * e ;
string_t st = StringVoid ;
string_t xt = StringVoid ;
int i ;
int r ;
z = zuluCryptLoopDeviceAddress_1( device ) ;
if( z == NULL ){
return NULL ;
}else{
st = String( "" ) ;
for( i = 0 ; i < 255 ; i++ ){
StringReplace( st,"/sys/block/loop" ) ;
StringAppendInt( st,i ) ;
xt = StringGetFromVirtualFile( StringAppend( st,"/loop/backing_file" ) ) ;
e = StringRemoveRight( xt,1 ) ;
r = StringsAreEqual( e,z ) ;
StringDelete( &xt ) ;
if( r ){
StringReplace( st,"/dev/loop" ) ;
e = StringAppendInt( st,i ) ;
if( StringsAreNotEqual( device,e ) ){
break ;
}
}else{
StringReset( st ) ;
}
}
StringFree( z ) ;
if( StringIsEmpty( st ) ){
StringDelete( &st ) ;
return NULL ;
}else{
return StringDeleteHandle( &st ) ;
}
}
}
示例13: IsCommand
// returns NULL if CommandPreffix is not command Command
// returns pointer to next token otherwise
LPTSTR IsCommand(LPTSTR Command, LPTSTR CommandPreffix)
{
// avoid case of empty string
if (StringIsEmpty(CommandPreffix))
return NULL;
while(*Command && *CommandPreffix && (*Command == *CommandPreffix)) {
Command++;
CommandPreffix++;
}
if(StringIsEmpty(CommandPreffix))
return CommandPreffix;
else if (*CommandPreffix == TEXT(' ')) {
while(*CommandPreffix == TEXT(' '))
CommandPreffix++;
return CommandPreffix;
} else
return NULL;
}
示例14: gettext
/**
* Looks up a string of text from the current language file
*
* Currently very simple. Looks up the current string and current language
* to find the appropriate string response. On failure will return
* the string itself.
*
* NOTES CACHING:
* - Could load the whole file or part
* - qsort/bsearch good idea
* - cache misses in data structure for future use
* @param text The text to search for
* @return The translation if found, otherwise the text itself
*/
const TCHAR*
gettext(const TCHAR* text)
{
assert(language_allowed);
assert(text != NULL);
// If empty string or no language file is loaded -> skip the translation
if (StringIsEmpty(text) || mo_file == NULL)
return text;
#ifdef _UNICODE
// Try to lookup the english string in the map of cached TCHAR translations
const tstring text2(text);
translation_map::const_iterator it = translations.find(text2);
if (it != translations.end())
// Return the looked up translation
return it->second.c_str();
// Convert the english TCHAR string to char
size_t wide_length = _tcslen(text);
char original[wide_length * 4 + 1];
// If the conversion failed -> use the english original string
if (::WideCharToMultiByte(CP_UTF8, 0, text, -1,
original, sizeof(original), NULL, NULL) <= 0)
return text;
// Lookup the converted english char string in the MO file
const char *translation = mo_file->lookup(original);
// If the lookup failed -> use the english original string
if (translation == NULL || *translation == 0 ||
strcmp(original, translation) == 0)
return text;
// Convert the translated char string to TCHAR
TCHAR translation2[strlen(translation) + 1];
if (::MultiByteToWideChar(CP_UTF8, 0, translation, -1, translation2,
ARRAY_SIZE(translation2)) <= 0)
return text;
// Add the translated TCHAR string to the cache map for the next time
translations[text2] = translation2;
// Return the translated TCHAR string
return translations[text2].c_str();
#else
// Search for the english original string in the MO file
const char *translation = mo_file->lookup(text);
// Return either the translated string if found or the original
return translation != NULL && *translation != 0 && ValidateUTF8(translation)
? translation
: text;
#endif
}
示例15: LoadFromOldProfile
bool
PolarGlue::LoadFromProfile(PolarInfo &polar)
{
const TCHAR *polar_string = Profile::Get(szProfilePolar);
if (polar_string != NULL && !StringIsEmpty(polar_string) &&
polar.ReadString(polar_string)) {
return true;
}
return LoadFromOldProfile(polar);
}