本文整理汇总了C++中CString::StrLength方法的典型用法代码示例。如果您正苦于以下问题:C++ CString::StrLength方法的具体用法?C++ CString::StrLength怎么用?C++ CString::StrLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CString
的用法示例。
在下文中一共展示了CString::StrLength方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MPGroup
CString CMail::MPGroup(const CString& iStr, int& curPos){
/*
group = phrase ":" [#mailbox] ";"
*/
#ifdef M_DEBUG
cout << "MPGroup() - " << curPos << endl;
#endif
CString Result;
CString Phrase = MPPhrase(iStr, curPos);
if (!Phrase.StrLength()) return "";
Result+=Phrase;
if (iStr[curPos]!=':') return "";
Result+=':';
int workingPos = curPos+1;
CString MBox;
if (iStr[workingPos]!=',') do {
if (iStr[workingPos] == ',') {
workingPos++;
Result+=',';
}
MBox = MPMailbox(iStr, curPos);
if (MBox.StrLength()) Result+=MBox; else break;
} while (iStr[workingPos] == ',');
if (iStr[workingPos] == ';'){
Result+=';';
workingPos++;
curPos = workingPos;
return Result;
} else return "";
}
示例2: write_full_admin
int cgi_admin_manager::write_full_admin(const CString& AdminClass, const CString& Equiv){
if ((!AdminClass.StrLength())||(!Equiv.StrLength())) return 0;
if (!equiv_file.StrLength()) {
current_cgi_admin_manager = this;
equiv_file = entry_manager::make_equiv_path("admin.struct");
}
#ifndef ANSI
chmod(equiv_file.asString(), _S_IREAD | _S_IWRITE);
#endif
int hfile2 = v_open(equiv_file.asString(), O_WRONLY | O_APPEND | O_CREAT, S_IRWXU);
if (hfile2 == -1) {
perror("<br>Error writing admin.struct:");
return 0;
}
write(hfile2, AdminClass.asString(), AdminClass.StrLength());
write(hfile2, ",", strlen(","));
write(hfile2, Equiv.asString(), Equiv.StrLength());
write(hfile2, "\n", strlen("\n"));
close(hfile2);
return 1;
}
示例3: MPDomainLiteral
CString CMail::MPDomainLiteral(const CString& iStr, int& curPos){
/*
domain-literal = "[" *(dtext / quoted-pair) "]"
*/
#ifdef M_DEBUG
cout << "MPDomainLiteral() - " << curPos << endl;
#endif
if (curPos < iStr.StrLength()) {
int workingPos = curPos;
if (iStr[workingPos] == '[') {
workingPos++;
while (workingPos < iStr.StrLength()) {
if (MPDtext(iStr, workingPos)) workingPos++;
else if (MPQuotedPair(iStr, workingPos)) workingPos++;
else break;
}
if (iStr[workingPos] == ']') {
CString Result = iStr.Copy(curPos, workingPos - curPos);
curPos = workingPos+1;
return Result;
} else return "";
} else return "";
} else return "";
}
示例4: MPMailbox
CString CMail::MPMailbox(const CString& iStr, int& curPos){
/*
mailbox = addr-spec ; simple address
/ phrase route-addr ; name & addr-spec
*/
#ifdef M_DEBUG
cout << "MPMailBox() - " << curPos << endl;
#endif
if (curPos < iStr.StrLength()) {
CString ASpec = MPAddressSpec(iStr, curPos);
if (!ASpec.StrLength()) {
CString Phrase = MPPhrase(iStr, curPos);
if (Phrase.StrLength()) {
CString RAddr = MPRouteAddr(iStr, curPos);
if (RAddr.StrLength()) {
CString Result = Phrase;
Result+=RAddr;
return Result;
} else return "";
} else return "";
} else return ASpec;
} else return "";
}
示例5: ProcessHeader
void CHttpRequest::ProcessHeader(inetSocket& Sock){
CString Line;
RHeaderResponse.clear();
RStatus.Free();
ProcessRStatus((Line = ReadLine(Sock)));
if (Line.StrLength()) do {
Line = ReadLine(Sock);
if (Line.StrLength()) {
RHeader+=Line;
ProcessOneLine(Line);
}
} while (Line.StrLength());
}
示例6: ReadRemaining
CString CHttpRequest::ReadRemaining(inetSocket& Sock){
char Buffer[MAX_BUFFER+1];
int Count = 0;
CString Result;
char c;
FD_ZERO(&fdset);
FD_SET(Sock.S,&fdset);
tv.tv_sec=RTimeout; tv.tv_usec=0;
while (select(Sock.S+1, &fdset, NULL, NULL, &tv) >= 0) {
if ((FD_ISSET(Sock.S,&fdset))&&(recv(Sock.S, &c, 1, 0)))
Buffer[Count++] = c; else break;
if (Count == MAX_BUFFER) {
Buffer[Count] = 0;
Result.StrAppend(Buffer, Count);
Count = 0;
if ((RLimit > 0)&&(Result.StrLength() >= RLimit)) return Result;
}
//if (c == EOF) break;
}
if (Count) {
Buffer[Count] = 0;
Result.StrAppend(Buffer, Count);
}
return Result;
}
示例7: Send
int CHttpRequest::Send(inetSocket& Sock, const CString& Request){
if (send(Sock.S,Request.asString(),Request.StrLength(),0) == -1) {
switch(errno) {
case EBADF: Sock.wserror("(sending to port) The socket argument is not a valid file descriptor."); break;
#ifdef ANSI
case ECONNRESET: Sock.wserror("(sending to port) A connection was forcibly closed by a peer."); break;
case EDESTADDRREQ: Sock.wserror("(sending to port) The socket is not connection-mode and no peer address is set."); break;
case EMSGSIZE: Sock.wserror("(sending to port) The message is too large be sent all at once, as the socket requires."); break;
case ENOTCONN: Sock.wserror("(sending to port) The socket is not connected or otherwise has not had the peer prespecified."); break;
case ENOTSOCK: Sock.wserror("(sending to port) The socket argument does not refer to a socket."); break;
case EOPNOTSUPP: Sock.wserror("(sending to port) The socket argument is associated with a socket that does not support one or more of the values set in flags."); break;
case ENETDOWN: Sock.wserror("(sending to port) The local interface used to reach the destination is down."); break;
case ENETUNREACH: Sock.wserror("(sending to port) No route to the network is present."); break;
case ENOBUFS: Sock.wserror("(sending to port) Insufficient resources were available in the system to perform the operation."); break;
#ifdef ENOSR
case ENOSR: Sock.wserror("(sending to port) There were insufficient STREAMS resources available for the operation to complete."); break;
#endif
#endif
case EINTR: Sock.wserror("(sending to port) A signal interrupted send() before any data was transmitted."); break;
case EPIPE: Sock.wserror("(sending to port) The socket is shut down for writing, or the socket is connection-mode and the peer is closed or shut down for reading. In the latter case, and if the socket is of type SOCK_STREAM, the SIGPIPE signal is generated to the calling process."); break;
case EAGAIN: Sock.wserror("(sending to port) The socket's file descriptor is marked O_NONBLOCK and the requested operation would block."); break;
case EIO: Sock.wserror("(sending to port) An I/O error occurred while reading from or writing to the file system."); break;
default : Sock.wserror("(sending to port) Unexpected error."); break;
}
RStatusValue = HTTPR_USER + 2;
return 0;
} else return 1;
}
示例8: write_full_access
int cgi_access_manager::write_full_access(const CString& Equiv, const CString& Password){
if (!equiv_file.StrLength()) {
current_cgi_access_manager = this;
equiv_file = entry_manager::make_equiv_path("access.struct");
}
#ifndef ANSI
chmod(equiv_file.asString(), _S_IREAD | _S_IWRITE);
#endif
int hfile2 = v_open(equiv_file.asString(), O_WRONLY | O_APPEND | O_CREAT, S_IRWXU);
if (hfile2 == -1) {
perror("<br>Error writing access.struct:");
return 0;
}
CString EPassword(Password);
write(hfile2, Equiv.asString(), Equiv.StrLength());
write(hfile2, ",", strlen(","));
CString EncryptedPassword(EPassword); EncryptedPassword.Encrypt();
write(hfile2, EncryptedPassword.asString(), EncryptedPassword.StrLength());
write(hfile2, "\n", strlen("\n"));
close(hfile2);
return 1;
}
示例9: MPDtext
char CMail::MPDtext(const CString& iStr, int& curPos){
/*
dtext = <any CHAR excluding "[", ; => may be folded
"]", "\" & CR, & including
linear-white-space>
*/
#ifdef M_DEBUG
cout << "MPDText() - " << curPos << endl;
#endif
if (curPos < iStr.StrLength()) {
char c = iStr[curPos];
switch(c){
case '[':
case ']':
case '\\':
case CR:
return 0;
}
char d;
if ((d = MPLinearWhiteSpace(iStr, curPos))) return d;
return c;
} else return 0;
}
示例10: add_admin
void cgi_admin_manager::add_admin(const CString& class_, const CString& category){
if (class_.StrLength()&&(class_[0]!='#')) {
CVector<CString> Tokens; category.Tokenizer('+',Tokens);
for (int i=0;i<Tokens.Count();i++){
entry_manager::add_value(Tokens[i], class_, Tokens[i]);
}
}
}
示例11: MPAddress
CString CMail::MPAddress(const CString& iStr, int& curPos){
/*
address = mailbox ; one addressee
/ group ; named list
*/
#ifdef M_DEBUG
cout << "MPAddress() - " << curPos << endl;
#endif
if (curPos < iStr.StrLength()) {
CString Mailbox = MPMailbox(iStr, curPos);
if (Mailbox.StrLength()) return Mailbox;
CString Group = MPGroup(iStr, curPos);
if (Group.StrLength()) return Group;
return "";
} else return "";
}
示例12: how_old_hours
int recent_manager::how_old_hours(const CString& article_date){
if (!(article_date.StrLength())) return(0);
struct tm *newtime; time_t aclock; time( &aclock ); newtime = localtime( &aclock );
struct tm thisdate = encode_date_article(article_date);
int day_diff = abs(- day_count(thisdate.tm_mon, thisdate.tm_mday, thisdate.tm_year) +
day_count(newtime->tm_mon + 1, newtime->tm_mday, newtime->tm_year));
int hour_diff = newtime->tm_hour - thisdate.tm_hour;
if (hour_diff < 0) {day_diff--; hour_diff+=24;}
return(day_diff * 24 + hour_diff);
}
示例13: MPDomain
CString CMail::MPDomain(const CString& iStr, int& curPos){
/*
domain = sub-domain *("." sub-domain)
*/
#ifdef M_DEBUG
cout << "MPDomain() - " << curPos << endl;
#endif
CString Result;
CString SubDomain;
int workingPos = curPos;
SubDomain = MPSubDomain(iStr, workingPos);
while ((iStr[workingPos] == '.') && SubDomain.StrLength() && (curPos < iStr.StrLength())){
workingPos++;
if (Result.StrLength()) Result+=".";
Result+=SubDomain;
SubDomain = MPSubDomain(iStr, workingPos);
}
if (SubDomain.StrLength()) {
if (Result.StrLength()) Result+=".";
Result+=SubDomain;
}
if (Result.StrLength()) curPos = workingPos;
return Result;
}
示例14: ProcessOneLine
void CHttpRequest::ProcessOneLine(const CString& Line){
int sPos = Line.Pos(':');
if (sPos > 0) {
RHeaderResponse.set_value(Line.Copy(0, sPos), Line.Copy(sPos+1, Line.StrLength()).StrTrim());
#ifdef _U_DEBUG
cout << "CHTTPREQUEST::Header:[" << Line.Copy(0, sPos) << "]:[" << Line.Copy(sPos+1, Line.StrLength()).StrTrim() << "]" << endl;
#endif
} else {
#ifdef _U_DEBUG
cout << "CHTTPREQUEST::Header (???):[" << Line << "]" << endl;
#endif
}
}
示例15: MPQuotedPair
char CMail::MPQuotedPair(const CString& iStr, int& curPos){
#ifdef M_DEBUG
cout << "MPQuotedPair() - " << curPos << endl;
#endif
if (curPos < iStr.StrLength()) {
if (iStr[curPos] == '\\') {
curPos++;
return iStr[curPos];
} else return 0;
} else return 0;
}