本文整理汇总了C++中FXString::length方法的典型用法代码示例。如果您正苦于以下问题:C++ FXString::length方法的具体用法?C++ FXString::length怎么用?C++ FXString::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FXString
的用法示例。
在下文中一共展示了FXString::length方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fileFromURI
// Obtain file path from URI specified as file:///bla/bla/bla...
// If no 'file:' prefix is found, return the input string as is
FXString fileFromURI(FXString uri)
{
if(comparecase("file:",uri,5)==0)
{
if(uri[5]==PATHSEPCHAR && uri[6]==PATHSEPCHAR)
return uri.mid(7,uri.length()-7);
return uri.mid(5,uri.length()-5);
}
return uri;
}
示例2:
void
CCLCFox::unlockWithPass(FXString tktstr)
{
/* char val[sizeof(id) + CCLC_MD5_DIGEST_LENGTH * sizeof(FXuchar)];
FXuchar digest[CCLC_MD5_DIGEST_LENGTH];
CCLC_MD5((FXuchar*)(password.text()),password.length(),digest);
((FXuint*)val)[0] = CCLC_htonl(id);*/
// memcpy(((FXuint*)val)+1,digest,CCLC_MD5_DIGEST_LENGTH);
if (tktstr.length() > MAX_INP_SIZE)
tktstr.trunc(MAX_INP_SIZE);
CCLC_send_cmd(CC_TICKETLOGIN, tktstr.text(),tktstr.length());
}
示例3: labelHeight
// Get height of multi-line label
FXint FXLabel::labelHeight(const FXString& text) const {
register FXint beg,end;
register FXint th=0;
beg=0;
do{
end=beg;
while(end<text.length() && text[end]!='\n') end++;
th+=font->getFontHeight();
beg=end+1;
}
while(end<text.length());
return th;
}
示例4: labelWidth
// Get width of multi-line label
FXint FXLabel::labelWidth(const FXString& text) const {
register FXint beg,end;
register FXint w,tw=0;
beg=0;
do{
end=beg;
while(end<text.length() && text[end]!='\n') end++;
if((w=font->getTextWidth(&text[beg],end-beg))>tw) tw=w;
beg=end+1;
}
while(end<text.length());
return tw;
}
示例5: endPage
void endPage() {
pageStarted = false;
flushSegment();
// build actual text object; +3 is for "ET\n"
// PDF1.4Ref(p38) EOL marker preceding endstream not counted
char *textObj = new char[pageData.length() + 100];
// concatenate stream within the text object
sprintf(textObj, "<</Length %d>>\nstream\n%s"
"ET\nendstream\n",
static_cast<int>(pageData.length() - 1 + 3),
pageData.text());
oT->add(textObj);
delete []textObj;
}
示例6: gmsplit
static void gmsplit(const FXString & in,FXStringList & output) {
FXint s=0;
FXint e=0;
FXint n=0;
const FXchar sep=',';
while(s<in.length()) {
// trim leading white space
while(in[s]==' ') s++;
e=s;
// find end
while(in[e]!=sep && in[e]!='\0') e++;
n=e+1;
e=e-1;
// trim end
while(e>=s && in[e]==' ') e--;
if (e>=s) {
output.no(output.no()+1);
output[output.no()-1].assign(&in[s],(e-s)+1);
}
s=n;
}
}
示例7: 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;
}
}
}
示例8: ReadClasses
// 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);
}
示例9: getDocumentName
FXString
MFXUtils::getTitleText(const FXString &appname, FXString filename) throw() {
if (filename.length()==0) {
return appname;
}
return getDocumentName(filename) + " - " + appname;
}
示例10: 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;
}
示例11: ParseLineNumberFromFilename
// Look for line number after filename in the form of FILE.EXT:NNN
static void ParseLineNumberFromFilename(FXString &filename, FXString &line)
{
#ifdef WIN32 // Ignore colon in drive spec on WIN32
FXint colons=filename.contains(':');
if (FXPath::isAbsolute(filename)) {
if (colons>1) {
line=filename.section(':',2);
filename=filename.section(':',0,2);
}
} else {
if (colons>0) {
line=filename.section(':',1) ;
filename=filename.section(':',0);
}
}
#else
if (filename.contains(':')) {
line=filename.section(':',1) ;
filename=filename.section(':',0);
}
#endif
for (FXint i=0; i<line.length(); i++) {
if (!Ascii::isDigit(line[i])) { // If it's not all digits, forget it.
line=FXString::null;
break;
}
}
}
示例12: icy_parse
void HttpInput::icy_parse(const FXString & str) {
FXString title = str.after('=').before(';');
if (title.length()) {
MetaInfo* meta = new MetaInfo();
meta->title = title;
input->post(meta);
}
}
示例13: rename
// Rename directory
FXbool FXDir::rename(const FXString& srcpath,const FXString& dstpath){
if(srcpath!=dstpath){
#ifdef WIN32
#ifdef UNICODE
FXnchar oldname[MAXPATHLEN],newname[MAXPATHLEN];
utf2ncs(oldname,MAXPATHLEN,srcpath.text(),srcpath.length()+1);
utf2ncs(newname,MAXPATHLEN,dstpath.text(),dstpath.length()+1);
return ::MoveFileExW(oldname,newname,MOVEFILE_REPLACE_EXISTING)!=0;
#else
return ::MoveFileExA(srcpath.text(),dstpath.text(),MOVEFILE_REPLACE_EXISTING)!=0;
#endif
#else
return ::rename(srcpath.text(),dstpath.text())==0;
#endif
}
return false;
}
示例14: sizeof
void
CCLCFox::unlockWithPass(FXString login,FXString password)
{
if (login.length() > MAX_INP_SIZE)
login.trunc(MAX_INP_SIZE);
const char *login_name = login.text();
char val[strlen(login_name) * sizeof(char) + 1
+ CCLC_MD5_DIGEST_LENGTH * sizeof(FXuchar)];
FXuchar digest[CCLC_MD5_DIGEST_LENGTH];
CCLC_MD5((FXuchar*)(password.text()),password.length(),digest);
memcpy(val,login_name,strlen(login_name) + 1);
memcpy(val + strlen(login_name) + 1,digest,CCLC_MD5_DIGEST_LENGTH);
CCLC_send_cmd(CC_MEMBERLOGINWITHNAME,val,sizeof(val) * sizeof(char));
if (!strncmp(login_name, _("administrator"), 13)){
if (checkPass((char *)password.text(), password.length()))
unlockScreen(); //unlock all the same
}
}
示例15: throw
FXString
MFXUtils::assureExtension(const FXString &filename, const FXString &defaultExtension) throw() {
FXString ext = FXPath::extension(filename);
if (ext=="") {
if (filename.rfind('.')==filename.length()-1) {
return filename + defaultExtension;
}
return filename + "." + defaultExtension;
}
return filename;
}