本文整理汇总了C++中CString::MakeReverse方法的典型用法代码示例。如果您正苦于以下问题:C++ CString::MakeReverse方法的具体用法?C++ CString::MakeReverse怎么用?C++ CString::MakeReverse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CString
的用法示例。
在下文中一共展示了CString::MakeReverse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateMisprintTipLib
bool MisprintManage::CreateMisprintTipLib()
{
CMainFrame *pFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd;
CString bookName=pFrame->m_wndProperties.m_pHtmlProperty->GetBookName();
bookName.TrimLeft(_T(" "));
bookName.TrimRight(_T(" "));
//获得当前可执行文件的路径
CString sModFileName;
GetModuleFileName(NULL,sModFileName.GetBuffer(MAX_PATH),MAX_PATH);
sModFileName.ReleaseBuffer();
sModFileName.MakeReverse();
CString sIniFilePath;
sIniFilePath=sModFileName.Right(sModFileName.GetLength()-sModFileName.Find( '\\'));
sIniFilePath.MakeReverse();
//当前路径和新建文件夹名
CString newFileName=sIniFilePath+bookName;
if(!PathFileExists(newFileName)){
//创建文件夹
if(!CreateDirectory(newFileName,NULL)) {
AfxMessageBox(_T("创建文件夹失败!"));
return false;
}
}
if(!PathFileExists(newFileName+_T("\\system"))){
if(!CreateDirectory(newFileName+_T("\\system"),NULL)) {
AfxMessageBox(_T("创建文件夹失败!"));
return false;
}
}
//错字库文件名
m_libFileName.Format(_T("%s\\system\\%s_错字库.txt"),newFileName,bookName);
try{
if(!PathFileExists(m_libFileName)){
m_misprintLibFile.Open(m_libFileName,CFile::modeCreate);
m_misprintLibFile.Close();
}
}
catch(CFileException fe)
{
AfxMessageBox(_T("创建错字库文件失败!"));
return false;
}
return true;
}
示例2: GetFileSize
///////////////////////////////////////////////////////////////////
// Function: GetFileSize()
// Purpose: Returns the comma seperated size of the file.
///////////////////////////////////////////////////////////////////
CString CSHFileInfo::GetFileSize()
{
CString strFileSize;
CString strTemp;
strTemp.Format(_T("%d"), m_pFoundFile->GetLength());
int nSize = strTemp.GetLength()-1;
int nCount = 1;
while (nSize >= 0)
{
strFileSize += strTemp.GetAt(nSize);
if (nSize == 0)
break;
if (nCount != 3)
++nCount;
else {
strFileSize += ",";
nCount = 1;
}
nSize--;
}
strFileSize.MakeReverse();
return strFileSize;
}
示例3: add
CString add(CString a,CString b)
{
CString c;
carry=0;
i=a.GetLength();
j=b.GetLength();
l=i;
l=i>j?i:j;
if(i>j)
insert(b,i-j,"0",1);
else
if(j>i)
insert(a,j-i,"0",1);
for(i=l;i>0;i--)
{
j = a.GetAt(i-1)-'0' + b.GetAt(i-1)-'0' + carry;
carry = j / 10;
j = j % 10;
c+=j+'0';
}
if(carry>0)
c+=carry+'0';
c.MakeReverse();
return c;
}
示例4: TcHexColor
CString TcHexColor(DWORD dwColor)
{
CString strHex = _T("");
while (dwColor != 0)
{
int iFlag = dwColor % 16;
switch (iFlag)
{
case 10:
strHex += _T("A");
break;
case 11:
strHex += _T("B");
break;
case 12:
strHex += _T("C");
break;
case 13:
strHex += _T("D");
break;
case 14:
strHex += _T("E");
break;
case 15:
strHex += _T("F");
break;
default:
CString strTemp;
strTemp.Format(_T("%i"), dwColor % 16);
strHex += strTemp;
break;
}
dwColor /= 16;
}
strHex.MakeReverse();
switch (strHex.GetLength())
{
case 0:
strHex = _T("000000");
break;
case 1:
strHex = _T("00000") + strHex;
break;
case 2:
strHex = _T("0000") + strHex;
break;
case 3:
strHex = _T("000") + strHex;
break;
case 4:
strHex = _T("00") + strHex;
break;
case 5:
strHex = _T("0") + strHex;
break;
}
return strHex;
}
示例5: InitMineModelFromFile
void CNoteModelDlg::InitMineModelFromFile()
{
CString sIniFilePath;
CString sModFileName;
GetModuleFileName(NULL,sModFileName.GetBuffer(MAX_PATH),MAX_PATH);
sModFileName.ReleaseBuffer();
sModFileName.MakeReverse();
sIniFilePath=sModFileName.Right(sModFileName.GetLength()-sModFileName.Find( '\\'));
sIniFilePath.MakeReverse();
this->m_filePath=sIniFilePath+_T("noteModel.txt");
CStdioFile file;
if(!file.Open(m_filePath,CFile::modeRead)){
AfxMessageBox(_T("打开注释模板文件失败"));
return;
}
CString rString;
file.ReadString(rString);
this->SetDlgItemTextW(IDC_NOTEMINE_LINE1_1,rString);
file.ReadString(rString);
this->SetDlgItemTextW(IDC_NOTEMINE_LINE1_2,rString);
file.ReadString(rString);
this->SetDlgItemTextW(IDC_NOTEMINE_LINE1_3,rString);
file.ReadString(rString);
this->SetDlgItemTextW(IDC_NOTEMINE_LINE1_4,rString);
file.ReadString(rString);
this->SetDlgItemTextW(IDC_NOTEMINE_LINE2_1,rString);
file.ReadString(rString);
this->SetDlgItemTextW(IDC_NOTEMINE_LINE2_2,rString);
file.ReadString(rString);
this->SetDlgItemTextW(IDC_NOTEMINE_LINE2_3,rString);
file.ReadString(rString);
this->SetDlgItemTextW(IDC_NOTEMINE_LINE2_4,rString);
file.ReadString(rString);
this->SetDlgItemTextW(IDC_NOTEMINE_LINE3_1,rString);
file.ReadString(rString);
this->SetDlgItemTextW(IDC_NOTEMINE_LINE3_2,rString);
file.ReadString(rString);
this->SetDlgItemTextW(IDC_NOTEMINE_LINE3_3,rString);
file.ReadString(rString);
this->SetDlgItemTextW(IDC_NOTEMINE_LINE3_4,rString);
}
示例6: GetDataFromTxt
void CUsefulStringList::GetDataFromTxt()
{
char* old_locale = _strdup( setlocale(LC_CTYPE,NULL) );
setlocale( LC_CTYPE, "chs" );//设定
//获得当前可执行文件的路径
CString sModFileName;
GetModuleFileName(NULL,sModFileName.GetBuffer(MAX_PATH),MAX_PATH);
sModFileName.ReleaseBuffer();
sModFileName.MakeReverse();
CString sIniFilePath;
sIniFilePath=sModFileName.Right(sModFileName.GetLength()-sModFileName.Find( '\\'));
sIniFilePath.MakeReverse();
//从文件中读取以前的信息
CStdioFile fOftenUseList;
m_fPath.Format(_T("%s//oftenUseList.txt"),sIniFilePath);
if(fOftenUseList.Open(m_fPath,CFile::modeRead)){
CString readStr;
CString shortcut;
if(fOftenUseList.ReadString(readStr)){
int strNum;
strNum=_wtoi(readStr);
for(int i=1;i<=strNum;i++){
fOftenUseList.ReadString(readStr);
InsertItem(i-1,readStr);
if(i<=9){
//快捷键
shortcut.Format(_T("Ctrl+%d"),i);
}
else{
shortcut=_T("无快捷键");
}
this->SetItemText(i-1,1,shortcut);
}
}
fOftenUseList.Close();
}
//恢复区域设定
setlocale( LC_CTYPE, old_locale );
free( old_locale );//还原区域设定
}
示例7:
CString CFanmotorDlg::int2bin_anybits(int dec, int length)
{
CString result;
int i;
for(i = (length - 1); i >=0; i--) {
if(dec%2){
result += "1";
}
else {
result += "0";
}
dec = dec/2;
}
result.MakeReverse();
return result;
}
示例8: GetMachineCode
// 根据网卡MAC计算得到一个唯一机器码
BOOL GetMachineCode(CString& szMachineCode)
{
/////////////////////////////////////////
u_char g_ucLocalMac[6]; // 本地MAC地址
//DWORD g_dwGatewayIP; // 网关IP地址
//DWORD g_dwLocalIP; // 本地IP地址
//DWORD g_dwMask; // 子网掩码
PIP_ADAPTER_INFO pAdapterInfo = NULL;
ULONG ulLen = 0;
// 为适配器结构申请内存
::GetAdaptersInfo(pAdapterInfo,&ulLen);
pAdapterInfo = (PIP_ADAPTER_INFO)::GlobalAlloc(GPTR, ulLen);
// 取得本地适配器结构信息
if(::GetAdaptersInfo(pAdapterInfo,&ulLen) == ERROR_SUCCESS)
{
if(pAdapterInfo != NULL)
{
memcpy(g_ucLocalMac, pAdapterInfo->Address, 6);
//g_dwGatewayIP = ::inet_addr(pAdapterInfo->GatewayList.IpAddress.String);
//g_dwLocalIP = ::inet_addr(pAdapterInfo->IpAddressList.IpAddress.String);
//g_dwMask = ::inet_addr(pAdapterInfo->IpAddressList.IpMask.String);
}
}
//printf(" \n -------------------- 本地主机信息 -----------------------\n\n");
//in_addr in;
//in.S_un.S_addr = g_dwLocalIP;
//printf(" IP Address : %s \n", ::inet_ntoa(in));
//in.S_un.S_addr = g_dwMask;
//printf(" Subnet Mask : %s \n", ::inet_ntoa(in));
//in.S_un.S_addr = g_dwGatewayIP;
//printf(" Default Gateway : %s \n", ::inet_ntoa(in));
u_char *p = g_ucLocalMac;
int nMasterVer = (int)PRODUCT_ID%100;
int nMonirVer = (int)PRODUCT_ID/100;
szMachineCode.Format("%02X%02X-%02X%d-%02X%02X-%02X%d", p[1]^0xFF, p[4]^0xFF, p[5]^0xFF, nMonirVer, p[0]^0xFF, p[2]^0xFF, p[3]^0xFF, nMasterVer);
szMachineCode.MakeReverse();
return TRUE;
}
示例9: HexToDec
int HexToDec(CString strHex)
{
int iLen = strHex.GetLength();
if (iLen > 2 || iLen < 1)
{
return 0;
}
else if (iLen == 1)
{
if (strHex == _T("A") || strHex == _T("a"))
{
return 10;
}
else if (strHex == _T("B") || strHex == _T("b"))
{
return 11;
}
else if (strHex == _T("C") || strHex == _T("c"))
{
return 12;
}
else if (strHex == _T("D") || strHex == _T("d"))
{
return 13;
}
else if (strHex == _T("E") || strHex == _T("e"))
{
return 14;
}
else if (strHex == _T("F") || strHex == _T("f"))
{
return 15;
}
else
{
return ::_ttoi(strHex);
}
}
else
{
strHex.MakeReverse();
return HexToDec(strHex.Mid(1, 1)) * 16 + HexToDec(strHex.Mid(0, 1));
}
}
示例10: IsBranchNameValid
bool CGit::IsBranchNameValid(CString branchname)
{
if (branchname.IsEmpty())
return false;
for(int i=0; i < branchname.GetLength(); i++)
{
TCHAR c = branchname.GetAt(i);
if (c <= ' ' || c == '~' || c == '^' || c == ':' || c == '\\' || c == '?' || c == '[')
return false;
}
if (branchname.Find(L".") == 0 || branchname.Find(L"/.") >= 0 || branchname.Find(L"..") >= 0 || branchname.Find(L"@{") >= 0 || branchname.ReverseFind('*') >= 0)
return false;
CString reverseBranchname = branchname.MakeReverse();
if (branchname.Find(L'.') == 0 || branchname.Find(L'/') == 0 || reverseBranchname.Find(L"kcol.") >= 0)
return false;
return true;
}
示例11: OnInitDialog
BOOL CDXprocessDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: 在此添加额外的初始化
m_dxprocessList.InsertColumn(0,_T("应用路径"),0,350);
CString sModFileName;
GetModuleFileName(NULL,sModFileName.GetBuffer(MAX_PATH),MAX_PATH);
sModFileName.ReleaseBuffer();
sModFileName.MakeReverse();
mv_filePath=sModFileName.Right(sModFileName.GetLength()-sModFileName.Find( '\\'));
mv_filePath.MakeReverse();
mv_filePath+=_T("DXprocess.txt");
CStdioFile sFile;
if(sFile.Open(mv_filePath,CFile::modeRead))
{
CString str;
int nItem=0;
while(sFile.ReadString(str))
{
if(str.GetLength()>0){
m_dxprocessList.InsertItem(nItem,str);
nItem++;
}
}
sFile.Close();
}
else
{
AfxMessageBox(_T("打开DX列表文件失败!"));
}
return TRUE; // return TRUE unless you set the focus to a control
// 异常: OCX 属性页应返回 FALSE
}
示例12: DoSpinID
void CJSRModParam::DoSpinID(NMHDR* pNMHDR, LRESULT* pResult, int MIN, int MAX, int DLGITEM)
{
if (m_pPS)m_pPS->SetToClose(0);
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
int iNew = pNMUpDown->iPos + pNMUpDown->iDelta;
if (iNew > MAX)
{
iNew = MAX;
pNMUpDown->iDelta = 0;
pNMUpDown->iPos = MAX;
}
if (iNew < MIN)
{
iNew = MIN;
pNMUpDown->iDelta = 0;
pNMUpDown->iPos = MIN;
}
char temp[3];
_itoa(iNew,temp,10);
while (strlen(temp) < 2)
{
temp[2] = NULL;
temp[1] = temp[0];
temp[0] = '0';
}
SetDlgItemText(DLGITEM,temp);
CString Text;
GetDlgItemText(IDC_JSRMODPARAMS_SAVELOC,Text);
// if "JSR" at end then...
Text.MakeReverse();
switch (Text.Find("RSJ"))
{
case 0:
Text.MakeReverse();
break;
case 1:
if (
((Text[0] >= '0') && (Text[0] <= '9')) ||
((Text[0] >= 'A') && (Text[0] <= 'Z')) ||
((Text[0] >= 'a') && (Text[0] <= 'z'))
)
{
Text.MakeReverse();
Text = Text.Left(Text.GetLength()-1);
}
else
{
Text.MakeReverse();
if (Text.Right(1) == "\\")
Text += "JSR";
else
Text += "\\JSR";
}
break;
case 2:
if (
(
((Text[0] >= '0') && (Text[0] <= '9')) ||
((Text[0] >= 'A') && (Text[0] <= 'Z')) ||
((Text[0] >= 'a') && (Text[0] <= 'z'))
) && (
((Text[1] >= '0') && (Text[1] <= '9')) ||
((Text[1] >= 'A') && (Text[1] <= 'Z')) ||
((Text[1] >= 'a') && (Text[1] <= 'z'))
)
)
{
Text.MakeReverse();
Text = Text.Left(Text.GetLength()-2);
}
else
{
Text.MakeReverse();
if (Text.Right(1) == "\\")
Text += "JSR";
else
Text += "\\JSR";
}
break;
default:
{
Text.MakeReverse();
if (Text.Right(1) == "\\")
Text += "JSR";
else
Text += "\\JSR";
}
}
*pResult = 0;
Text += temp;
SetDlgItemText(IDC_JSRMODPARAMS_SAVELOC,Text);
}
示例13: DoSpinID
void CEventModParam::DoSpinID(NMHDR* pNMHDR, LRESULT* pResult, int MIN, int MAX, int DLGITEM)
{
if (m_pPS) m_pPS->SetToClose(0);
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
int iNew = pNMUpDown->iPos + pNMUpDown->iDelta;
if (iNew > MAX)
{
iNew = MAX;
pNMUpDown->iDelta = 0;
pNMUpDown->iPos = MAX;
}
if (iNew < MIN)
{
iNew = MIN;
pNMUpDown->iDelta = 0;
pNMUpDown->iPos = MIN;
}
char temp[3];
if (iNew > 99)
{
int iTemp = iNew - 100;
int i1 = iTemp/36;
int i2 = iTemp % 36;
temp[0] = (char)('A' + i1);
if (i2 < 10)
temp[1] = (char)('0' + i2);
else
temp[1] = (char)('A' + i2-10);
}
else
sprintf(temp,"%02d",iNew);
temp[2] = NULL;
SetDlgItemText(DLGITEM,temp);
CString Text;
GetDlgItemText(IDC_EVENTMODPARAMS_SAVELOC,Text);
// if "EVENT" at end of name
Text.MakeReverse();
switch (Text.Find("TNEVE"))
{
case 0:
Text.MakeReverse();
break;
case 1:
if (
((Text[0] >= '0') && (Text[0] <= '9')) ||
((Text[0] >= 'A') && (Text[0] <= 'Z')) ||
((Text[0] >= 'a') && (Text[0] <= 'z'))
)
{
Text.MakeReverse();
Text = Text.Left(Text.GetLength()-1);
}
else
{
Text.MakeReverse();
if (Text.Right(1) == "\\")
Text += "EVENT";
else
Text += "\\EVENT";
}
break;
case 2:
if (
(
((Text[0] >= '0') && (Text[0] <= '9')) ||
((Text[0] >= 'A') && (Text[0] <= 'Z')) ||
((Text[0] >= 'a') && (Text[0] <= 'z'))
) && (
((Text[1] >= '0') && (Text[1] <= '9')) ||
((Text[1] >= 'A') && (Text[1] <= 'Z')) ||
((Text[1] >= 'a') && (Text[1] <= 'z'))
)
)
{
Text.MakeReverse();
Text = Text.Left(Text.GetLength()-2);
}
else
{
Text.MakeReverse();
if (Text.Right(1) == "\\")
Text += "EVENT";
else
Text += "\\EVENT";
}
break;
default:
{
Text.MakeReverse();
if (Text.Right(1) == "\\")
Text += "EVENT";
else
Text += "\\EVENT";
//.........这里部分代码省略.........
示例14: OnChar
//.........这里部分代码省略.........
else if (scn->ch == ',' && !bInline)
{
//scintWin.SendMessage(SCI_AUTOCCOMPLETE, 0, 0);
if (m_ParameterTooltipIsVisible && !m_QuotesOpen)
m_Tooltip.ShowNextParam();
}
// Hide parameter tooltip
else if (scn->ch == ')' && !bInline)
{
//scintWin.SendMessage(SCI_AUTOCCOMPLETE, 0, 0);
if (m_ParameterTooltipIsVisible)
{
m_Tooltip.ShowWindow(SW_HIDE);
m_ParameterTooltipIsVisible = false;
}
}
// Hide parameter tooltip
else if (scn->ch == '"')
{
if (m_QuotesOpen)
m_QuotesOpen = false;
else
m_QuotesOpen = true;
}
// Prompt variable names
else if (scn->ch == '\'')
{
// Trim the right two (' chars eg. Sprite('
text = text.Left(text.GetLength() - 2);
CString temp = text;
temp.MakeReverse();
int index = temp.FindOneOf(" {}()+-*/");
if (index > -1)
text = text.Right(index);
// Now find if there's a dot to get the object name
index = text.Find('.');
if (index > -1)
text = text.Left(index);
CObjType* pType = GetTypeFromName(pApp, text);
if (pType != NULL) {
CString varnames;
vector<PrivateValue>::iterator i = pType->m_PrivateValues.begin();
vector<PrivateValue>::iterator end = pType->m_PrivateValues.end();
for ( ; i != end; i++)
varnames += i->name + "|";
varnames = varnames.Left(varnames.GetLength() - 1);
if (varnames != "")
::SendMessage(scintWin.m_hWnd, SCI_AUTOCSHOW, 0, (long)(const char*)varnames);
}
else{
if(text == "global")
{
示例15: cleanValue
CFieldValuePair::DumpARX(CARSConnection &arsConnect, CString Form, CStdioFile &File,
CString &strAttachDir, unsigned int *p_uiAttachNum,
CEntryId &EntryId, CString &strBuffer)
{
// Insert a space before the value
// File.Write(" ", 1);
strBuffer += " ";
CString cleanValue(Value);
// dump the value to the file
switch(uiType)
{
case AR_DATA_TYPE_NULL:
//File.Write("\"\"", 2);
strBuffer += "\"\"";
break;
// basically an value exported via this case will not have any double
// quotes exported
case AR_DATA_TYPE_INTEGER:
case AR_DATA_TYPE_REAL:
case AR_DATA_TYPE_ENUM:
case AR_DATA_TYPE_TIME:
case AR_DATA_TYPE_DECIMAL:
//File.Write(LPCSTR(Value), Value.GetLength()); // write the value
strBuffer += Value;
break;
// any value exported via this case will have double quotes
// inserted before and after the Value.
case AR_DATA_TYPE_CHAR:
case AR_DATA_TYPE_DIARY:
case AR_DATA_TYPE_CURRENCY: // treat currency like a char because we need to double quotes
cleanValue.Replace("\"", "\\\""); // insert a \ before each double quote
cleanValue.Replace("\n", "\\r\\n"); // replace carriage returns with \r\n text
//File.Write("\"", 1); // write double quote before value
strBuffer += "\"";
//File.Write(LPCSTR(cleanValue), cleanValue.GetLength()); // write the text value
strBuffer += cleanValue;
//File.Write("\"", 1); // write double quote after value
strBuffer += "\"";
break;
case AR_DATA_TYPE_ATTACH:
CString strExt; // working extenstion of the attachment
CString strFile; // working file name with no extension
CString strAttachNum; // working string for attachment number
CString strFinishedAttach; // working completed attachment name to use when calling GetEntryBLOB()
CString strFilePath; // the full path the the filename for saving the BLOB file
// Save the file extension
strExt = Value;
strExt.MakeReverse();
strExt = strExt.Left(4);
strExt.MakeReverse();
// Save the file name with out extenstion
strFile = Value.Left(Value.GetLength() - 4);
// convert the Attachment number to a string and increment it
strAttachNum.Format("%d", *p_uiAttachNum);
*p_uiAttachNum = *p_uiAttachNum + 1;
// build the completed attachment name to save
// strBuffer += "\"" + strAttachDir + "\\" + strFile + "_" + \
// strAttachNum + strExt + "\"";
strFinishedAttach = strAttachDir + "\\" + strFile + "_" + strAttachNum + strExt;
strBuffer += "\"" + strFinishedAttach + "\"";
// Lastly, save the attachment file BLOB
// This function call needs the full path\filename to save the BLOB
// this should be specified in strAttachFileName
strFilePath = File.GetFilePath();
strFilePath.Replace(File.GetFileName(), LPCSTR(strFinishedAttach)); // replace the filename with the relative attachment name
DumpAttachment(arsConnect, Form, EntryId, uiFieldId, strFilePath);
break;
} // end switch
}