本文整理汇总了C++中FXString类的典型用法代码示例。如果您正苦于以下问题:C++ FXString类的具体用法?C++ FXString怎么用?C++ FXString使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FXString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadSettings
void GMSourceView::init() {
loadSettings("window");
clear();
listsources();
FXString key = getApp()->reg().readStringEntry("window","source-list-current","");
if (!key.empty()){
FXTreeItem * item = sourcelist->getFirstItem();
while(item){
GMSource * src = static_cast<GMSource*>(item->getData());
if (src->settingKey()==key) {
sourcelist->setCurrentItem(item);
break;
}
item=item->getBelow();
}
}
if (sourcelist->getCurrentItem()==nullptr && sourcelist->getFirstItem())
sourcelist->setCurrentItem(sourcelist->getFirstItem());
source=static_cast<GMSource*>(sourcelist->getItemData(sourcelist->getCurrentItem()));
GMPlayerManager::instance()->getTrackView()->init(source);
}
示例2: strwlen
void ID3V2::parse_comment_frame(FXint framesize) {
FXString key,field;
const FXuchar & encoding = buffer[p];
const FXchar* textstart = (const FXchar*)(buffer+p+4);
const FXint textlength = framesize - 4;
if (encoding==UTF16_BOM || encoding==UTF16) {
FXint ksize = strwlen(textstart,textlength);
FXint vsize = strwlen(textstart+ksize+2,textlength-ksize-2);
parse_text(encoding,textstart,ksize,key);
parse_text(encoding,textstart+ksize+2,vsize,field);
}
else {
FXint ksize = strnlen(textstart,textlength);
FXint vsize = strnlen(textstart+ksize+1,textlength-ksize-1);
parse_text(encoding,textstart,ksize,key);
parse_text(encoding,textstart+ksize+1,vsize,field);
}
FXString comment = key + " " + field;
if (comment.find("iTunSMPB")>=0) {
comment.simplify().scan("iTunSMPB %*x %hx %hx %lx",&padstart,&padend,&length);
GM_DEBUG_PRINT("[id3v2] found iTunSMPB (padding %d %d, length %ld)\n",padstart,padend,length);
}
}
示例3: getText
long fx_numeric_field::change_on_digit(int sign)
{
FXString txt = getText();
int pos = getCursorPos();
int pow_exp, dot_pos;
int norm = get_normalized_int (txt.text(), pow_exp, dot_pos);
if (dot_pos < 0) return 0;
int pos_exp = dot_pos - pos;
if (pos_exp < 0)
pos_exp ++;
int inc_abs = ipow10 (pos_exp + pow_exp);
norm += sign * inc_abs;
FXString new_txt = denormalize (norm, pow_exp, dot_pos);
int new_pos = dot_pos - pos_exp;
if (pos_exp < 0)
new_pos ++;
setText(new_txt);
setCursorPos(new_pos);
if (target)
target->tryHandle(this, FXSEL(SEL_CHANGED,message), (void*)new_txt.text());
return 1;
}
示例4: getSUMOTime
long
GNETLSEditorFrame::onCmdPhaseEdit(FXObject*, FXSelector, void* ptr) {
/* @note: there is a bug when copying/pasting rows: when this handler is
* called the value of the cell is not yet updated. This means you have to
* click inside the cell and hit enter to actually update the value */
FXTablePos* tp = (FXTablePos*)ptr;
FXString value = myPhaseTable->getItemText(tp->row, tp->col);
if (tp->col == 0) {
// duration edited
if (GNEAttributeCarrier::canParse<SUMOReal>(value.text())) {
SUMOTime duration = getSUMOTime(value);
if (duration > 0) {
myEditedDef->getLogic()->setPhaseDuration(tp->row, duration);
myHaveModifications = true;
updateCycleDuration();
return 1;
}
}
// input error, reset value
myPhaseTable->setItemText(tp->row, 0, toString(STEPS2TIME(getPhases()[tp->row].duration)).c_str());
} else {
// state edited
try {
// insert phase with new step and delete the old phase
myEditedDef->getLogic()->addStep(getPhases()[tp->row].duration, value.text(), tp->row);
myEditedDef->getLogic()->deletePhase(tp->row + 1);
myHaveModifications = true;
onCmdPhaseSwitch(0, 0, 0);
} catch (ProcessError) {
// input error, reset value
myPhaseTable->setItemText(tp->row, 1, getPhases()[tp->row].state.c_str());
}
}
return 1;
}
示例5: deltime
// Convert the deletion date to the number of seconds since the epoch
// The string representing the deletion date must be in the format YYYY-MM-DDThh:mm:ss
long deltime(FXString delstr)
{
// Decompose the date into year, month, day, hour, minutes and seconds
FXString year=delstr.mid(0,4);
FXString mon=delstr.mid(5,2);
FXString mday=delstr.mid(8,2);
FXString hour=delstr.mid(11,2);
FXString min=delstr.mid(14,2);
FXString sec=delstr.mid(17,2);
// Convert date using mktime()
tm tmval;
tmval.tm_sec=atoi(sec.text());
tmval.tm_min=atoi(min.text());
tmval.tm_hour=atoi(hour.text());
tmval.tm_mday=atoi(mday.text());
tmval.tm_mon=atoi(mon.text());
tmval.tm_year=atoi(year.text())-1900;
tmval.tm_isdst=0;
long t=(long)mktime(&tmval);
// If conversion failed, return 0
if (t<0)
t=0;
return t;
}
示例6:
void
PlaybackWindow::setPlaybackPacketsProcessed(unsigned int packets)
{
FXString s;
s.format("Processed %u of %u", packets_processed, total_packets);
processedLabel->setText(s);
}
示例7: GM_DEBUG_PRINT
void InputThread::ctrl_open_input(const FXString & uri) {
GM_DEBUG_PRINT("[input] ctrl_open_input %s\n",uri.text());
if (uri.empty()) {
goto failed;
}
/// Open Input
input=open_input(uri);
if (input==NULL) {
engine->post(new ErrorMessage(FXString::value("Unable to open %s",uri.text())));
goto failed;
}
reader = open_reader();
if (reader==NULL) {
engine->post(new ErrorMessage(FXString::value("No input plugin available for %s",uri.text())));
goto failed;
}
if (!reader->init(input)) {
engine->post(new ErrorMessage(FXString::value("Failed to initialize plugin")));
goto failed;
}
streamid++;
set_state(StateProcessing,true);
return;
failed:
ctrl_close_input();
set_state(StateIdle,true);
}
示例8: checkPass
bool
checkPass(char *pass, int plen)
{
char pstr[64];
FILE *fp;
FXString pname;
pname = FXSystem::getHomeDirectory() + "/.mkahawa/mkahawa.inf";
fp = fopen(pname.text(), "r");
if (fp){
FXuchar digest[CCLC_MD5_DIGEST_LENGTH];
CCLC_MD5((FXuchar*)(pass), plen, digest);
fread(pstr, CCLC_MD5_DIGEST_LENGTH, 1, fp);
if (plen > CCLC_MD5_DIGEST_LENGTH) plen = CCLC_MD5_DIGEST_LENGTH;
if (!memcmp(pstr, digest, plen))
return TRUE;
fclose(fp);
#ifdef DEBUG_PASS
printf("Realpass Hash: ");
print_hash((unsigned char *)digest, CCLC_MD5_DIGEST_LENGTH);
printf("\n");
printf("Testpass Hash: ");
print_hash((unsigned char *)pstr, CCLC_MD5_DIGEST_LENGTH);
printf("\n");
#endif
}
return FALSE;
}
示例9: sprintf
void
GenesisFrame::setOverrideOptions(void)
{
if (m_useOverride->getCheck())
{
if (m_overrideGenesis->getCheck())
m_commandLineHandler->addOption("--gen");
if (m_overrideHeaderSize->getCheck())
{
char option[80];
FXString text = m_overrideHeaderSizeText->getText();
sprintf(option, "--hdn=%s", text.text());
m_commandLineHandler->addOption(option);
}
if (m_overrideHeader->getCheck())
m_commandLineHandler->addOption("--hd");
if (m_overrideNoHeader->getCheck())
m_commandLineHandler->addOption("--nhd");
if (m_overrideNotSplit->getCheck())
m_commandLineHandler->addOption("--ns");
if (m_overrideInterleaved->getCheck())
m_commandLineHandler->addOption("--int");
if (m_overrideInterleaved2->getCheck())
m_commandLineHandler->addOption("--int2");
if (m_overrideNotInterleaved->getCheck())
m_commandLineHandler->addOption("--nint");
}
}
示例10: cmdio
// Run ctags in each source directory
void TagParserBase::ReadClasses()
{
CmdIO cmdio(mainwin);
CmdStr cmd=CtagsCmd();
FXString currdir=FXSystem::getCurrentDirectory();
FXRex rx("\\.(c|cc|cpp|cxx|h|hh|hpp|hxx)$",FXRex::IgnoreCase);
for (FXint i=0; i<DirList().no(); i++) {
const FXString dir=DirList().at(i)->dirname();
if (dir.empty()) { continue; }
if (FXSystem::setCurrentDirectory(dir)) {
FXDir de(dir);
if (de.isOpen()) {
FXString fn;
while (de.next(fn)) {
if (FXStat::isFile(fn) && (rx.search(fn,0,fn.length())>=0)) { cmd+=fn.text(); }
}
de.close();
current_filename=FXString::null;
cmdio.setUserData((void*)(FXival)i);
cmdio.lines(cmd.text(),this,ID_READ_ALL_FILES_LINES);
}
}
}
FXSystem::setCurrentDirectory(currdir);
}
示例11: ap_parse_pls
void ap_parse_pls(const FXString & data,FXStringList & mrl) {
FXint start=0,end=0,pos,next;
for (FXint i=0;i<data.length();i++) {
if (data[i]=='\n') {
end=i;
next=i+1;
/// Skip white space
while(start<end && Ascii::isSpace(data[start])) start++;
/// Skip white space
while(end>start && Ascii::isSpace(data[end])) end--;
/// Parse the actual line.
if ((end-start)>6) {
if (compare(&data[start],"File",4)==0) {
pos = data.find('=',start+4);
if (pos==-1) continue;
pos++;
if (end-pos>0) {
mrl.append(data.mid(pos,1+end-pos));
}
}
}
start=next;
}
}
}
示例12: open
// Open directory to path, return true if ok.
FXbool FXDir::open(const FXString& path){
if(!path.empty()){
#ifdef WIN32
#ifdef UNICODE
FXnchar buffer[MAXPATHLEN];
utf2ncs(buffer,MAXPATHLEN,path.text(),path.length()+1);
wcsncat(buffer,TEXT("\\*"),MAXPATHLEN);
#else
FXchar buffer[MAXPATHLEN];
strncpy(buffer,path.text(),MAXPATHLEN);
strncat(buffer,"\\*",MAXPATHLEN);
#endif
((SPACE*)space)->handle=FindFirstFile(buffer,&((SPACE*)space)->result);
if(((SPACE*)space)->handle!=INVALID_HANDLE_VALUE){
((SPACE*)space)->first=true;
return true;
}
#else
((SPACE*)space)->handle=opendir(path.text());
if(((SPACE*)space)->handle!=NULL){
return true;
}
#endif
}
return false;
}
示例13: next
// Go to next directory entry and return its name
FXbool FXDir::next(FXString& name){
if(isOpen()){
#ifdef WIN32
if(((SPACE*)space)->first || FindNextFile(((SPACE*)space)->handle,&((SPACE*)space)->result)){
((SPACE*)space)->first=false;
name.assign(((SPACE*)space)->result.cFileName);
return true;
}
#else
#if defined(FOX_THREAD_SAFE) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
if(!readdir_r(((SPACE*)space)->handle,&((SPACE*)space)->result,&((SPACE*)space)->dp) && ((SPACE*)space)->dp){
name.assign(((SPACE*)space)->dp->d_name);
return true;
}
#else
if((((SPACE*)space)->dp=readdir(((SPACE*)space)->handle))!=NULL){
name.assign(((SPACE*)space)->dp->d_name);
return true;
}
#endif
#endif
}
name.clear();
return false;
}
示例14: update_textfield
static void update_textfield(fx_numeric_field *tf, fx_disp_window *disp_win, int param_id)
{
FXString vstr;
double *pvalue = disp_win->map_parameter(param_id);
vstr.format("%g", *pvalue);
tf->setText(vstr);
}
示例15: getFilenames
/*
Fox doesn't automatically handle MS-Windows shortcut files, so...
Iterate through each filename in the file dialog's getFilenames() list,
if any of them are shortcut (*.lnk) files, dereference the link and
make the string point to the "real" disk file. If we have multiple files,
remove any links that point to a directory. But if we only have one string
in the list, and the string is a link pointing to a directory, we will
dereference it so the dialog can change into that folder.
*/
static void FixupShortcuts(FXWindow*w, FXString* filenames)
{
if (!filenames) return;
FXString* fn;
FXString* tail=filenames;
FXuint count=0;
for (fn=filenames; !fn->empty(); fn++) {
if (IsLinkExt(*fn)) {
char*tmp=NULL;
if (ReadShortcut(&tmp, fn->text())) {
*fn=tmp;
} else {
FXMessageBox::error(w,MBOX_OK,_("Error in shortcut"),"%s\n%s",fn->text(),tmp);
}
free(tmp);
}
tail=fn;
count++;
}
if (count>1) {
for (fn=filenames; !fn->empty(); fn++) {
if (FXStat::isDirectory(*fn)) {
*fn=tail->text();
*tail="";
tail--;
}
}
}
}