本文整理汇总了C++中wxString::GetData方法的典型用法代码示例。如果您正苦于以下问题:C++ wxString::GetData方法的具体用法?C++ wxString::GetData怎么用?C++ wxString::GetData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxString
的用法示例。
在下文中一共展示了wxString::GetData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wxrubyAssert
NORETURN(void wxrubyAssert(const wxString& file,
int line,
const wxString& func,
const wxString& cond,
const wxString& msg)
{
rb_fatal("(%s) in %s \n %s",
cond.GetData().AsChar(),
func.GetData().AsChar(),
msg.GetData().AsChar()
);
})
示例2: init
void PARSE_ERROR::init( const char* aThrowersFile, const char* aThrowersLoc,
const wxString& aMsg, const wxString& aSource,
const char* aInputLine,
int aLineNumber, int aByteIndex )
{
// save inpuLine, lineNumber, and offset for UI (.e.g. Sweet text editor)
inputLine = aInputLine;
lineNumber = aLineNumber;
byteIndex = aByteIndex;
errorText.Printf( PARSE_FORMAT, aMsg.GetData(), aSource.GetData(),
aLineNumber, aByteIndex,
wxString::FromUTF8( aThrowersFile ).GetData(),
wxString::FromUTF8( aThrowersLoc ).GetData() );
}
示例3: GetFileName
// ----------------------------------------------------------------------------
void SettingsDlg::GetFileName(wxString& newFileName)
// ----------------------------------------------------------------------------
{
newFileName = wxEmptyString;
// Ask user for filename
wxFileDialog dlg(this, //parent window
_T("Select file "), //message
wxEmptyString, //default directory
wxEmptyString, //default file
wxT("*.*"), //wildcards
wxFD_OPEN | wxFD_FILE_MUST_EXIST ); //style
// move dialog into the parents frame space
wxPoint mousePosn = ::wxGetMousePosition();
(&dlg)->Move(mousePosn.x, mousePosn.y);
if (dlg.ShowModal() != wxID_OK) return;
newFileName = dlg.GetPath();
#ifdef LOGGING
LOGIT( _T("New filename[%s]"), newFileName.GetData() );
#endif //LOGGING;
}
示例4: OnInit
bool WinEDA_App::OnInit(void)
{
wxString msg;
wxString currCWD = wxGetCwd();
EDA_Appl = this;
InitEDA_Appl( wxT("cvpcb") );
if ( m_Checker && m_Checker->IsAnotherRunning() )
{
if ( ! IsOK(NULL, _("Cvpcb is already running, Continue?") ) )
return false;
}
GetSettings(); // read current setup
wxSetWorkingDirectory(currCWD); // mofifie par GetSetting
SetRealLibraryPath( wxT("modules") );
if(argc > 1 )
{
NetInNameBuffer = argv[1];
NetNameBuffer = argv[1];
}
if ( ! NetInNameBuffer.IsEmpty() )
wxSetWorkingDirectory( wxPathOnly(NetInNameBuffer) );
g_DrawBgColor = BLACK;
Read_Config(NetInNameBuffer);
m_CvpcbFrame = new WinEDA_CvpcbFrame(this, Main_Title);
msg.Printf( wxT("Modules: %d"), nblib);
m_CvpcbFrame->SetStatusText(msg,2);
// Show the frame
SetTopWindow(m_CvpcbFrame);
m_CvpcbFrame->Show(TRUE);
listlib();
m_CvpcbFrame->BuildModListBox();
if( ! NetInNameBuffer.IsEmpty() ) /* nom de fichier passe a la commande */
{
FFileName = MakeFileName(NetDirBuffer,
NetInNameBuffer, NetInExtBuffer);
m_CvpcbFrame->ReadNetListe();
}
else /* Mise a jour du titre de la fenetre principale */
{
msg.Printf( wxT("%s {%s%c} [no file]"),
Main_Title.GetData(), wxGetCwd().GetData(), DIR_SEP);
m_CvpcbFrame->SetTitle(msg);
}
return TRUE;
}
示例5: wxFrame
ViewFrame::ViewFrame(const wxString& filepath)
: wxFrame(NULL, wxID_ANY, filepath, wxDefaultPosition, wxSize(250, 150))
{
frozen = false;
wxMenuBar* menubar = new wxMenuBar();
wxMenu* filemenu = new wxMenu();
filemenu->Append(wxID_OPEN, "Open\tCtrl-O");
filemenu->Append(wxID_CLOSE, "Close Window\tCtrl-W");
filemenu->Append(wxID_EXIT, "Quit\tCtrl-Q");
menubar->Append(filemenu, "File");
SetMenuBar(menubar);
MarkdownRenderer renderer;
viewer = wxWebView::New(this, wxID_ANY);
if(!renderer.render(filepath.GetData())) {
std::cerr << renderer.getErrMsg() << std::endl;
return;
}
viewer->SetPage(renderer.getData(), filepath);
frozen = true;
Centre();
Show(true);
}
示例6: sprintPinNetName
void NETLIST_EXPORTER::sprintPinNetName( wxString& aResult,
const wxString& aNetNameFormat, NETLIST_OBJECT* aPin,
bool aUseNetcodeAsNetName )
{
int netcode = aPin->GetNet();
// Not wxString::Clear(), which would free memory. We want the worst
// case wxString memory to grow to avoid reallocation from within the
// caller's loop.
aResult.Empty();
if( netcode != 0 && aPin->GetConnectionType() == PAD_CONNECT )
{
if( aUseNetcodeAsNetName )
{
aResult.Printf( wxT("%d"), netcode );
}
else
{
aResult = aPin->GetNetName();
if( aResult.IsEmpty() ) // No net name: give a name from net code
aResult.Printf( aNetNameFormat.GetData(), netcode );
}
}
}
示例7: GetActualContextForMacro
bool Tokenizer::GetActualContextForMacro(Token* tk, wxString& actualContext)
{
// e.g. "#define AAA AAA" and usage "AAA(x)"
if (!tk || tk->m_Name == tk->m_Type)
return false;
// 1. break the args into substring with ","
wxArrayString formalArgs;
if (ReplaceBufferForReparse(tk->m_Args, false))
SpliteArguments(formalArgs);
// 2. splite the actual macro arguments
wxArrayString actualArgs;
if (!formalArgs.IsEmpty()) // e.g. #define AAA(x) x \n #define BBB AAA \n BBB(int) variable;
SpliteArguments(actualArgs);
// 3. get actual context
actualContext = tk->m_Type;
const size_t totalCount = std::min(formalArgs.GetCount(), actualArgs.GetCount());
for (size_t i = 0; i < totalCount; ++i)
{
TRACE(_T("GetActualContextForMacro(): The formal args are '%s' and the actual args are '%s'."),
formalArgs[i].wx_str(), actualArgs[i].wx_str());
wxChar* data = const_cast<wxChar*>((const wxChar*)actualContext.GetData());
const wxChar* dataEnd = data + actualContext.Len();
const wxChar* target = formalArgs[i].GetData();
const int targetLen = formalArgs[i].Len();
wxString alreadyReplaced;
alreadyReplaced.Alloc(actualContext.Len() * 2);
while (true)
{
const int pos = GetFirstTokenPosition(data, dataEnd - data, target, targetLen);
if (pos != -1)
{
alreadyReplaced << wxString(data, pos) << actualArgs[i];
data += pos + targetLen;
if (data == dataEnd)
break;
}
else
{
alreadyReplaced << data;
break;
}
}
actualContext = alreadyReplaced;
}
// 4. erease string "##"
actualContext.Replace(_T("##"), wxEmptyString);
TRACE(_T("The replaced actual context are '%s'."), actualContext.wx_str());
return true;
}
示例8: init
void IO_ERROR::init( const char* aThrowersFile, const char* aThrowersLoc, const wxString& aMsg )
{
// The throwers filename is a full filename, depending on Kicad source location.
// a short filename will be printed (it is better for user, the full filename has no meaning).
wxString srcname = wxString::FromUTF8( aThrowersFile );
errorText.Printf( IO_FORMAT, aMsg.GetData(),
srcname.AfterLast( '/' ).GetData(),
wxString::FromUTF8( aThrowersLoc ).GetData() );
}
示例9: SelectTagsByFile
wxSQLite3ResultSet TagsDatabase::SelectTagsByFile(const wxString& file, const wxFileName& path)
{
// Incase empty file path is provided, use the current file name
wxFileName databaseFileName(path);
path.IsOk() == false ? databaseFileName = m_fileName : databaseFileName = path;
OpenDatabase(databaseFileName);
wxString query;
query = wxString::Format(_T("select * from tags where file='%s';"), file.GetData());
return m_db->ExecuteQuery(query.GetData());
}
示例10: OnDropText
// ----------------------------------------------------------------------------
bool SnippetDropTarget::OnDropText(wxCoord x, wxCoord y, const wxString& data)
// ----------------------------------------------------------------------------
{
// Put dragged text into SnippetTextCtrl
#ifdef LOGGING
LOGIT( _T("Dragged Data[%s]"), data.GetData() );
#endif //LOGGING
//m_Window->m_SnippetEditCtrl->WriteText(data);
m_Window->m_SnippetEditCtrl->AddText(data);
return true;
} // end of OnDropText
示例11: MakeCommandLine
wxString NETLIST_EXPORTER::MakeCommandLine( const wxString& aFormatString,
const wxString& aTempfile, const wxString& aFinalFile, const wxString& aProjectPath )
{
wxString ret = aFormatString;
wxFileName in = aTempfile;
wxFileName out = aFinalFile;
ret.Replace( wxT( "%P" ), aProjectPath.GetData(), true );
ret.Replace( wxT( "%B" ), out.GetName().GetData(), true );
ret.Replace( wxT( "%I" ), in.GetFullPath().GetData(), true );
ret.Replace( wxT( "%O" ), out.GetFullPath().GetData(), true );
return ret;
}
示例12: StringToColor
//-----------------------------------------------------------------------------
wxColor Property::StringToColor (wxString strColor)
{
std::string stdStrColor(strColor.GetData());
std::string::size_type posK0 = stdStrColor.find_first_of("(");
std::string::size_type posD0 = stdStrColor.find_first_of(",");
std::string strRed = stdStrColor.substr(posK0+1, posD0-posK0-1);
std::string::size_type posD1 = stdStrColor.find_last_of(",");
std::string::size_type posK1 = stdStrColor.find_first_of(")");
std::string strGreen = stdStrColor.substr(posD0+1, posD1-posD0-1);
std::string strBlue = stdStrColor.substr(posD1+1, posK1-posD1);
int red = atoi(strRed.c_str());
int green = atoi(strGreen.c_str());
int blue = atoi(strBlue.c_str());
return wxColor((unsigned char)red, (unsigned char)green,
(unsigned char)blue);
}
示例13: throw
FILE_LINE_READER::FILE_LINE_READER( const wxString& aFileName,
unsigned aStartingLineNumber,
unsigned aMaxLineLength ) throw( IO_ERROR ) :
LINE_READER( aMaxLineLength ),
iOwn( true )
{
fp = wxFopen( aFileName, wxT( "rt" ) );
if( !fp )
{
wxString msg = wxString::Format(
_( "Unable to open filename '%s' for reading" ), aFileName.GetData() );
THROW_IO_ERROR( msg );
}
source = aFileName;
lineNum = aStartingLineNumber;
}
示例14: if
static inline long parseInt( const wxString& aValue, double aScalar )
{
double value = LONG_MAX;
/*
* In 2011 gEDA/pcb introduced values with units, like "10mm" or "200mil".
* Unit-less values are still centimils (100000 units per inch), like with
* the previous format.
*
* Distinction between the even older format (mils, 1000 units per inch)
* and the pre-2011 format is done in ::parseMODULE already; the
* distinction is by wether an object definition opens with '(' or '['.
* All values with explicite unit open with a '[' so there's no need to
* consider this distinction when parsing them.
*
* The solution here is to watch for a unit and, if present, convert the
* value to centimils. All unit-less values are read unaltered. This way
* the code below can contine to consider all read values to be in mils or
* centimils. It also matches the strategy gEDA/pcb uses for backwards
* compatibility with its own layouts.
*
* Fortunately gEDA/pcb allows only units 'mil' and 'mm' in files, see
* definition of ALLOW_READABLE in gEDA/pcb's pcb_printf.h. So we don't
* have to test for all 11 units gEDA/pcb allows in user dialogs.
*/
if( aValue.EndsWith( wxT( "mm" ) ) )
{
aScalar *= 100000.0 / 25.4;
}
else if( aValue.EndsWith( wxT( "mil" ) ) )
{
aScalar *= 100.;
}
// This conversion reports failure on strings as simple as "1000", still
// it returns the right result in &value. Thus, ignore the return value.
aValue.ToCDouble(&value);
if( value == LONG_MAX ) // conversion really failed
{
THROW_IO_ERROR( wxString::Format( _( "Cannot convert \"%s\" to an integer" ),
aValue.GetData() ) );
return 0;
}
return KiROUND( value * aScalar );
}
示例15: FootprintDelete
void GPCB_PLUGIN::FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName,
const PROPERTIES* aProperties )
{
LOCALE_IO toggle; // toggles on, then off, the C locale.
init( aProperties );
cacheLib( aLibraryPath );
if( !m_cache->IsWritable() )
{
THROW_IO_ERROR( wxString::Format( _( "Library '%s' is read only" ),
aLibraryPath.GetData() ) );
}
m_cache->Remove( aFootprintName );
}