本文整理汇总了C++中wxString::ToAscii方法的典型用法代码示例。如果您正苦于以下问题:C++ wxString::ToAscii方法的具体用法?C++ wxString::ToAscii怎么用?C++ wxString::ToAscii使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxString
的用法示例。
在下文中一共展示了wxString::ToAscii方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PushBlock
//----------------------------------------------------------------------------
void medHTMLTemplateParserBlock::PushBlock( wxString name, int blockType )
//----------------------------------------------------------------------------
{
int varPos=SubstitutionPos(&name);
int blockPos;
//blocks can be pushed only on loop blocks
if (m_BlockType!=MED_HTML_TEMPLATE_LOOP)
{
mafLogMessage("HTML Template ERROR: You can push sub-blocks only on Loop blocks, , use AddBLock instead");
return;
}
//we need to set the loop number before any push
else if (m_LoopsNumber<0)
{
mafLogMessage("HTML Template ERROR: You must set the loops number before push any sub-block");
return;
}
//if the block does not exists i need to create the array entry
if (varPos<0)
{
//creating the new array for this block and
//adding the substitution in the substitution table
std::vector<medHTMLTemplateParserBlock *> newArray;
m_SubBlocksArray.push_back(newArray);
HTMLTemplateSubstitution subst;
subst.Name=name;
subst.Pos=m_SubBlocksArray.size()-1;
subst.Type=MED_HTML_SUBSTITUTION_BLOCK_ARRAY;
varPos=m_SubstitutionTable.size();
m_SubstitutionTable.push_back(subst);
}
//if the block already exist there are already the correspondent array
//and the relative substitution so we don't need to add it
blockPos=m_SubstitutionTable[varPos].Pos;
//checking if the existent substitution refers to a block array to
if (m_SubstitutionTable[varPos].Type!=MED_HTML_SUBSTITUTION_BLOCK_ARRAY)
{
mafLogMessage("HTML Template ERROR: Array: \"%s\" has incompatible type",name.ToAscii());
return;
}
//checking if there are free slots for pushing blocks
else if (m_SubBlocksArray[blockPos].size()>m_LoopsNumber)
{
mafLogMessage("HTML Template ERROR: to many push for: '%s'",name.ToAscii());
return;
}
else
{
medHTMLTemplateParserBlock *newBlock;
newBlock=new medHTMLTemplateParserBlock(blockType, name);
newBlock->SetFather(this);
m_SubBlocksArray[blockPos].push_back(newBlock);
}
}
示例2: layoutGraph
void Trace::layoutGraph(wxString infile, wxString outfile)
{
char tmpinfile[FILELEN] = {0};
char tmpoutfile[FILELEN] = {0};
strncpy(tmpinfile, infile.ToAscii(), sizeof(tmpinfile) - 1);
strncpy(tmpoutfile, outfile.ToAscii(), sizeof(tmpoutfile) - 1);
this->layoutGraph(tmpinfile, tmpoutfile);
}
示例3: PushVar
//----------------------------------------------------------------------------
void medHTMLTemplateParserBlock::PushVar( wxString name, wxString varValue )
//----------------------------------------------------------------------------
{
int varPos=SubstitutionPos(&name);
int blockPos;
//We can push Variables only to the loops block
if (m_BlockType!=MED_HTML_TEMPLATE_LOOP)
{
mafLogMessage("HTML Template ERROR: You can push variables only on Loop blocks, use AddVar instead");
return;
}
//We need to set the loop number before pushing anything to the loop
else if (m_LoopsNumber<0)
{
mafLogMessage("HTML Template ERROR: You must set the loops number before push any variable");
return;
}
//if the vars does not exists i need to create the array entry
if (varPos<0)
{
std::vector<wxString> newArray;
m_VariablesArray.push_back(newArray);
HTMLTemplateSubstitution subst;
subst.Name=name;
subst.Pos=m_VariablesArray.size()-1;
subst.Type=MED_HTML_SUBSTITUTION_VARIABLE_ARRAY;
//if a new entry is created in the substitution table the position is
//equal at the size before the push
varPos=m_SubstitutionTable.size();
m_SubstitutionTable.push_back(subst);
}
blockPos=m_SubstitutionTable[varPos].Pos;
//checking substitusion type before push
if (m_SubstitutionTable[varPos].Type!=MED_HTML_SUBSTITUTION_VARIABLE_ARRAY)
{
mafLogMessage("HTML Template ERROR: Array: \"%s\" has incompatible type",name.ToAscii());
return;
}
//checking if there are free slots for pushing vars
else if (m_VariablesArray[blockPos].size()>m_LoopsNumber)
{
mafLogMessage("HTML Template ERROR: to many push for: '%s'",name.ToAscii());
return;
}
m_VariablesArray[blockPos].push_back(varValue);
}
示例4: convertDirectory
/*! Converts multiple files
*
* @param dirPath - path to directory
*
* @param filename - name of file, may include wild-cards
*/
int convertDirectory(const wxString &dirPath, const wxString &filename, MyTraverser &converter ) {
wxDir directory(dirPath);
fprintf(stdout, "------------------------------------------------------------------\n");
fprintf(stdout, " convertDirectory(): \n"
" dirPath = \'%s\'\n"
" filename = \'%s\'\n",
(const char *)dirPath.ToAscii(),
(const char *)filename.ToAscii() );
// printf("Processing Pattern %s\n", (const char *)dirPath.ToAscii());
directory.Traverse(converter, filename, wxDIR_FILES);
fprintf(stdout, "------------------------------------------------------------------\n");
return converter.getRc();
}
示例5: wxGetCommandOutput
// private utility function which returns output of the given command, removing
// the trailing newline
static wxString wxGetCommandOutput(const wxString &cmd)
{
FILE *f = popen(cmd.ToAscii(), "r");
if ( !f )
{
wxLogSysError(wxT("Executing \"%s\" failed"), cmd.c_str());
return wxEmptyString;
}
wxString s;
char buf[256];
while ( !feof(f) )
{
if ( !fgets(buf, sizeof(buf), f) )
break;
s += wxString::FromAscii(buf);
}
pclose(f);
if ( !s.empty() && s.Last() == wxT('\n') )
s.RemoveLast();
return s;
}
示例6: writeGmlFile
// Wrapper for wxWidgets
void Trace::writeGmlFile(wxString infile)
{
char gmlfile[FILELEN] = {0};
strncpy(gmlfile, infile.ToAscii(), sizeof(gmlfile));
this->writeGmlFile(gmlfile);
}
示例7: resolve_host
/**
@brief
Function Resolve the hostname to ip
*/
bool turbotrace::resolve_host(wxString host)
{
//Get hostname as a char pointer
char *target = strdup( (char*) host.ToAscii().data());
log( _("Will now resolve : ") + wxString(target , wxConvUTF8) );
//Is it just a simple IP
if( inet_addr( target ) != INADDR_NONE)
{
dest_ip.s_addr = inet_addr( target );
tlog(_("Valid IP provided"));
}
//Domain name , resolve it
else
{
char *ip = iputils::hostname_to_ip( (char*) target );
if(ip != NULL)
{
tlog( wxString(target , wxConvUTF8) + _(" resolved to ") + wxString(ip , wxConvUTF8));
//Convert domain name to IP
dest_ip.s_addr = inet_addr( ip );
}
else
{
tlog( _("Unable to resolve hostname : ") + wxString(target , wxConvUTF8) );
return false;
}
}
return true;
}
示例8: GetFontDefinition
wxString CSourceDataGenerator::GetFontDefinition(const EMGL_font_t *font, const wxString &name)
{
wxString result;
result += wxString::Format("const EMGL_font_t font_%s = {%d, %u, %u, codePageTable};\n",
name.ToAscii(), font->ascender, font->bpp, font->numCodepages);
return result;
}
示例9: OpenImage
bool isoimage::OpenImage(const wxString &filename)
{
const wxCharBuffer buffer = filename.ToAscii();
const char *path = buffer.data();
return m_image.open(path, ISO_EXTENSION_ALL);
}
示例10: runTest
static void runTest(const wxString inputLine)
{
done = false;
time(&startTime);
TestCommand command = parseInputLine(std::string(inputLine.ToAscii()));
string& pathOrURL = command.pathOrURL;
dumpPixelsForCurrentTest = command.shouldDumpPixels;
// CURL isn't happy if we don't have a protocol.
size_t http = pathOrURL.find("http://");
if (http == string::npos)
pathOrURL.insert(0, "file://");
gTestRunner = TestRunner::create(pathOrURL, command.expectedPixelHash);
if (!gTestRunner) {
wxTheApp->ExitMainLoop();
}
WorkQueue::shared()->clear();
WorkQueue::shared()->setFrozen(false);
webView->LoadURL(wxString(pathOrURL.c_str(), wxConvUTF8));
// wait until load completes and the results are dumped
while (!done)
wxSafeYield();
}
示例11: ReadDir
bool isoimage::ReadDir(const wxString &path, stat_vector_t& stat_vector)
{
const wxCharBuffer buffer = path.ToAscii();
const char *spath = buffer.data();
return m_image.readdir(spath, stat_vector);
}
示例12: ProfileFindInFilesCodeMode
void ProfileFindInFilesCodeMode() {
printf("*******\n");
wxLongLong time = wxGetLocalTimeMillis();
t4p::DirectorySearchClass directorySearch;
t4p::SourceClass src;
src.RootDirectory.AssignDir(DirName);
src.SetIncludeWildcards(wxT("*.php"));
std::vector<t4p::SourceClass> sources;
sources.push_back(src);
if (directorySearch.Init(sources)) {
t4p::FindInFilesClass findInFiles;
findInFiles.Expression = UNICODE_STRING_SIMPLE("class Db");
findInFiles.Mode = t4p::FinderClass::EXACT;
if (findInFiles.Prepare()) {
while (directorySearch.More()) {
directorySearch.Walk(findInFiles);
}
std::vector<wxString> matchedFiles = directorySearch.GetMatchedFiles();
for (size_t i = 0; i < matchedFiles.size(); ++i) {
printf("Found at least one match in file %s.\n", (const char*)matchedFiles[i].ToUTF8());
}
time = wxGetLocalTimeMillis() - time;
printf("time for findInFiles Code Mode:%ld ms\n", time.ToLong());
} else {
puts("Invalid expression: class Db\n");
}
} else {
printf("Could not open Directory: %s\n", (const char*)DirName.ToAscii());
}
}
示例13: ProfileFindInFilesExactMode
void ProfileFindInFilesExactMode() {
printf("*******\n");
wxLongLong time = wxGetLocalTimeMillis();
t4p::DirectorySearchClass directorySearch;
if (directorySearch.Init(DirName)) {
t4p::FindInFilesClass findInFiles;
findInFiles.Expression = UNICODE_STRING_SIMPLE("class Db");
findInFiles.Mode = t4p::FinderClass::EXACT;
if (findInFiles.Prepare()) {
while (directorySearch.More()) {
directorySearch.Walk(findInFiles);
}
std::vector<wxString> matchedFiles = directorySearch.GetMatchedFiles();
for (size_t i = 0; i < matchedFiles.size(); ++i) {
printf("Found at least one match in file %s.\n", (const char*)matchedFiles[i].ToUTF8());
}
time = wxGetLocalTimeMillis() - time;
printf("time for findInFiles Exact Mode:%ld ms \n", time.ToLong());
} else {
puts("Invalid expression: class Db\n");
}
} else {
printf("Could not open Directory: %s\n", (const char*)DirName.ToAscii());
}
}
示例14: SetId
void wxDataFormat::SetId( const wxString& id )
{
#if !wxUSE_NANOX
PrepareFormats();
m_type = wxDF_PRIVATE;
m_format = XInternAtom( (Display*) wxGetDisplay(), id.ToAscii(), FALSE );
#endif
}
示例15: StrToDouble
double StrToDouble(const wxString &value)
{
wxCharBuffer buf = value.ToAscii();
char *p = (char *)strchr(buf, '.');
if (p)
*p = localeconv()->decimal_point[0];
return strtod(buf, 0);
}