本文整理汇总了C++中TOLOG函数的典型用法代码示例。如果您正苦于以下问题:C++ TOLOG函数的具体用法?C++ TOLOG怎么用?C++ TOLOG使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TOLOG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TOLOG
bool CWizIndexBase::TagFromGUID(const CString& strTagGUID, WIZTAGDATA& data)
{
if (!strTagGUID || !*strTagGUID) {
TOLOG(_T("TagGUID is empty"));
return false;
}
CString strWhere;
strWhere.Format(_T("TAG_GUID=%s"),
STR2SQL(strTagGUID).utf16()
);
CString strSQL = FormatQuerySQL(TABLE_NAME_WIZ_TAG, FIELD_LIST_WIZ_TAG, strWhere);
CWizTagDataArray arrayTag;
if (!SQLToTagDataArray(strSQL, arrayTag)) {
TOLOG(_T("Failed to get tag by guid"));
return false;
}
if (arrayTag.empty()) {
//TOLOG(_T("Failed to get tag by guid, result is empty"));
return false;
}
data = arrayTag[0];
return true;
}
示例2: wrap
BOOL CWizKMDatabaseServer::attachment_getData2(const QString& strAttachmentGUID, UINT nParts, WIZDOCUMENTATTACHMENTDATAEX& ret)
{
WIZDOCUMENTATTACHMENTDATAEX wrap(ret);
//
CWizKMAttachmentGetDataParam param(WIZKM_WEBAPI_VERSION, m_kbInfo.strToken, m_kbInfo.strKbGUID, strAttachmentGUID, nParts);
//
if (!Call(_T("attachment.getData"), wrap, ¶m))
{
TOLOG(_T("attachment.getData failure!"));
return FALSE;
}
//
ret = wrap;
//
if (nParts & WIZKM_XMKRPC_ATTACHMENT_PART_DATA)
{
ATLASSERT(!ret.arrayData.isEmpty());
if (!ret.arrayData.isEmpty())
{
TOLOG(_T("fault error: ret.arrayData is null!"));
return FALSE;
}
//
if (!data_download(ret.strGUID, _T("attachment"), ret.arrayData, ret.strName))
{
TOLOG1(_T("Failed to download attachment data: %1"), ret.strName);
return FALSE;
}
}
//
//
return TRUE;
}
示例3: WizAESDecryptToFile
bool WizAESDecryptToFile(const unsigned char* cipher, \
QDataStream* inStream, const QString& strFileName)
{
Q_ASSERT(inStream->device()->isOpen());
QFile file(strFileName);
if (file.exists()) {
TOLOG("file already exist");
return false;
}
if (!file.open(QIODevice::ReadWrite)) {
TOLOG("Can't open file");
return false;
}
QDataStream os(&file);
if(!simpleAESDecrypt(cipher, inStream, &os)) {
TOLOG("AES decrypt failed");
return false;
}
file.close();
return true;
}
示例4: TOLOG
BOOL CWizXmlRpcArrayValue::Read(CWizXMLNode& nodeValue)
{
CWizXMLNode nodeData;
if (!nodeValue.FindNodeByPath(_T("array/data"), nodeData))
{
TOLOG(_T("Failed to get array data node!"));
return FALSE;
}
//
std::deque<CWizXMLNode> arrayValue;
nodeData.GetAllChildNodes(arrayValue);
//
for (std::deque<CWizXMLNode>::iterator it = arrayValue.begin();
it != arrayValue.end();
it++)
{
CWizXMLNode& nodeElementValue = *it;
//
CWizXmlRpcValue* pElementValue = NULL;
if (!WizXmlRpcValueFromXml(nodeElementValue, &pElementValue ))
{
TOLOG(_T("Failed to load array element value from node!"));
return FALSE;
}
//
ATLASSERT(pElementValue);
//
Add(pElementValue);
}
//
return TRUE;
}
示例5: Q_ASSERT
bool CWizSearchIndexer::updateDocuments(const CWizDocumentDataArray& arrayDocuments)
{
Q_ASSERT(!arrayDocuments.empty());
void* pHandle = NULL;
bool ret = WizFTSBeginUpdateDocument(m_strIndexPath.toStdWString().c_str(), &pHandle);
if (!ret) {
TOLOG("begin update failed while update FTS index");
return false;
}
int nErrors = 0;
for (int i = 0; i < arrayDocuments.size(); i++) {
WIZDOCUMENTDATAEX doc = arrayDocuments.at(i);
if (!_updateDocumentImpl(pHandle, doc))
nErrors++;
}
ret = WizFTSEndUpdateDocument(pHandle);
if (!ret) {
TOLOG("end update failed while update FTS index");
return false;
}
if (nErrors >= 5) {
return false;
}
return true;
}
示例6: TOLOG
void CWizSync::on_kbSyncDone(bool bError)
{
if (bError) {
m_bStarted = false;
TOLOG(tr("Error occured while syncing, Try to syncing next time"));
Q_EMIT syncDone(true);
return;
}
if (!m_arrayGroup.size()) {
m_bStarted = false;
TOLOG(tr("Syncing finished"));
Q_EMIT syncDone(false);
return;
}
WIZGROUPDATA group(m_arrayGroup[0]);
m_arrayGroup.erase(m_arrayGroup.begin());
// open group database for syncing
if (!m_dbMgr.isOpened(group.strGroupGUID)) {
m_bStarted = false;
TOLOG(tr("FATAL: Can't open group database!"));
Q_EMIT syncDone(false);
return;
}
m_kbSync->setDatabase(m_dbMgr.db(group.strGroupGUID));
// reset db info and start sync group data
TOLOG1(tr("Begin syncing group data: %1"), group.strGroupName);
m_kbSync->startSync(group.strGroupGUID);
}
示例7: TOLOG
bool CWizDatabaseManager::openAll()
{
// first, open private db
if (!open()) {
TOLOG("open user private database failed");
return false;
}
// second, get groups info
CWizGroupDataArray arrayGroup;
if (!m_dbPrivate->GetUserGroupInfo(arrayGroup)) {
TOLOG("Failed to get user group info");
return true;
}
// third, open groups one by one
CWizGroupDataArray::const_iterator it;
for (it = arrayGroup.begin(); it != arrayGroup.end(); it++) {
WIZGROUPDATA group = *it;
if (!open(group.strGroupGUID)) {
TOLOG1("failed to open group: %1", group.strGroupName);
}
}
return true;
}
示例8: CString
bool CThumbIndex::AbstractIsExist(const CString& guid, const CString& type)
{
if(!m_dbThumb.IsOpened())
return false;
CString sql = CString("select ") + "ABSTRACT_GUID" + " from " +TABLE_NAME_ABSTRACT+" where ABSTRACT_GUID='"
+guid+ ("' AND ABSTRACT_TYPE=")
+STR2SQL(type)
+(";");
try {
CppSQLite3Query query = m_dbThumb.execQuery(sql);
while (!query.eof()) {
return true;
}
return false;
}
catch (const CppSQLite3Exception& e)
{
TOLOG(e.errorMessage());
TOLOG(sql);
return false;
}
catch (...) {
TOLOG("Unknown exception while close DB");
return false;
}
}
示例9: TOLOG
bool WizXmlRpcArrayValue::read(WizXMLNode& nodeValue)
{
WizXMLNode nodeData;
if (!nodeValue.findNodeByPath("array/data", nodeData))
{
TOLOG("Failed to get array data node!");
return false;
}
std::deque<WizXMLNode> arrayValue;
nodeData.getAllChildNodes(arrayValue);
std::deque<WizXMLNode>::iterator it;
for (it = arrayValue.begin(); it != arrayValue.end(); it++)
{
WizXMLNode& nodeElementValue = *it;
WizXmlRpcValue* pElementValue = NULL;
if (!WizXmlRpcValueFromXml(nodeElementValue, &pElementValue))
{
TOLOG("Failed to load array element value from node!");
return false;
}
Q_ASSERT(pElementValue);
add(pElementValue);
}
return true;
}
示例10: sourceFile
bool CWizZiwReader::encryptDataToTempFile(const QString& sourceFileName, \
const QString& destFileName, \
const QString& strZiwCipher)
{
QFile sourceFile(sourceFileName);
if (!sourceFile.open(QIODevice::ReadOnly)) {
TOLOG("Can't open source file while encrypt to temp file");
return false;
}
// encrypt data
QByteArray inBytes(sourceFile.readAll());
QByteArray outBytes;
if (!WizAESEncryptToString((const unsigned char *)(strZiwCipher.toUtf8().constData()), inBytes, outBytes)) {
return false;
}
// encrypt ziw cipher
QByteArray encryptedZiwCipher;
if (!encryptZiwCipher(strZiwCipher.toUtf8(), encryptedZiwCipher)) {
return false;
}
// compose file
// FIXME: hard coded here.
WIZZIWHEADER header;
memset(&header, 0, sizeof(header));
header.szSign[0] = 'Z';
header.szSign[1] = 'I';
header.szSign[2] = 'W';
header.szSign[3] = 'R';
header.nVersion = 1;
header.nKeyLength = WIZZIWFILE_KEY_LENGTH;
memcpy(header.szEncryptedKey, encryptedZiwCipher.constData(), sizeof(header.szEncryptedKey));
QFile destFile(destFileName);
if (!destFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
TOLOG("Can't open dest file while encrypt to temp file");
return false;
}
QDataStream out(&destFile);
if (sizeof(header) != out.writeRawData((const char *)&header, sizeof(header))) {
TOLOG("Write data failed while encrypt to temp file");
destFile.remove();
return false;
}
if (outBytes.length() != out.writeRawData(outBytes.constData(), outBytes.length())) {
TOLOG("Write data failed while encrypt to temp file");
destFile.remove();
return false;
}
destFile.close();
sourceFile.close();
return true;
}
示例11: simpleRSADecrypt
bool simpleRSADecrypt(const char* N, const char* e, const char* d, \
QDataStream* pStreamSrc, QDataStream* pStreamDest)
{
Q_ASSERT(pStreamSrc->device()->isOpen());
Q_ASSERT(pStreamDest->device()->isOpen());
pStreamSrc->device()->seek(0);
pStreamDest->device()->seek(0);
int nSrcLen = pStreamSrc->device()->size();
if (nSrcLen > 256)
{
TOLOG("nSrcLen > 256");
return false;
}
unsigned char src[256];
memset(src, 0, sizeof(src));
if (pStreamSrc->readRawData((char *)src, nSrcLen) != nSrcLen) {
TOLOG("Input stream is not correct");
return false;
}
unsigned char ret[128];
memset(ret, 0, sizeof(ret));
CRSA enc;
try
{
enc.initPrivateKey(N, e, d);
}
catch (std::exception& e)
{
TOLOG(e.what());
return false;
}
if (enc.getPlainLen(nSrcLen) > 117)
{
TOLOG("enc.getPlainLen(nSrcLen) > 117");
return false;
}
int nRetOlen = enc.decrypt(src, nSrcLen, ret);
assert(nRetOlen < 117);
if (pStreamDest->writeRawData((const char *)ret, nRetOlen) == -1) {
TOLOG("WizStreamWrite(pStreamDest, ret, nRetOlen) failed");
return false;
}
pStreamDest->device()->seek(0);
return true;
}
示例12: WizXmlRpcResultFromXml
bool WizXmlRpcResultFromXml(WizXMLDocument& doc, WizXmlRpcValue** ppRet)
{
WizXMLNode nodeMethodResponse;
doc.findChildNode("methodResponse", nodeMethodResponse);
if (nodeMethodResponse.isNull())
{
TOLOG("Failed to get methodResponse node!");
return false;
}
WizXMLNode nodeTest;
if (!nodeMethodResponse.getFirstChildNode(nodeTest))
{
TOLOG("Failed to get methodResponse child node!");
return false;
}
QString strTestName = nodeTest.getName();
if (0 == strTestName.compare("params", Qt::CaseInsensitive))
{
WizXMLNode nodeParamValue;
nodeTest.findNodeByPath("param/value", nodeParamValue);
if (nodeParamValue.isNull())
{
TOLOG("Failed to get param value node of params!");
return false;
}
return WizXmlRpcValueFromXml(nodeParamValue, ppRet);
}
else if (0 == strTestName.compare("fault", Qt::CaseInsensitive))
{
WizXMLNode nodeFaultValue;
nodeTest.findChildNode("value", nodeFaultValue);
if (nodeFaultValue.isNull())
{
TOLOG("Failed to get fault value node!");
return false;
}
WizXmlRpcFaultValue* pFault = new WizXmlRpcFaultValue();
pFault->read(nodeFaultValue);
*ppRet = pFault;
return true;
}
else
{
TOLOG1("Unknown response node name: %1", strTestName);
return false;
}
}
示例13: WizXmlRpcResultFromXml
bool WizXmlRpcResultFromXml(CWizXMLDocument& doc, CWizXmlRpcValue** ppRet)
{
CWizXMLNode nodeMethodResponse;
doc.FindChildNode("methodResponse", nodeMethodResponse);
if (nodeMethodResponse.isNull())
{
TOLOG("Failed to get methodResponse node!");
return false;
}
CWizXMLNode nodeTest;
if (!nodeMethodResponse.GetFirstChildNode(nodeTest))
{
TOLOG("Failed to get methodResponse child node!");
return false;
}
CString strTestName = nodeTest.GetName();
if (0 == strTestName.CompareNoCase("params"))
{
CWizXMLNode nodeParamValue;
nodeTest.FindNodeByPath("param/value", nodeParamValue);
if (nodeParamValue.isNull())
{
TOLOG("Failed to get param value node of params!");
return false;
}
return WizXmlRpcValueFromXml(nodeParamValue, ppRet);
}
else if (0 == strTestName.CompareNoCase("fault"))
{
CWizXMLNode nodeFaultValue;
nodeTest.FindChildNode(_T("value"), nodeFaultValue);
if (nodeFaultValue.isNull())
{
TOLOG("Failed to get fault value node!");
return false;
}
CWizXmlRpcFaultValue* pFault = new CWizXmlRpcFaultValue();
pFault->Read(nodeFaultValue);
*ppRet = pFault;
return true;
}
else
{
TOLOG1("Unknown response node name: %1", strTestName);
return false;
}
}
示例14: TOLOG
void CWizZiwReader::debugPrintHeader()
{
TOLOG(m_header.szSign);
TOLOG(QString::number(m_header.nVersion));
TOLOG(QString::number(m_header.nKeyLength));
//TOLOG(QString::fromStdString(base64_encode(m_header.szEncryptedKey, sizeof(m_header.szEncryptedKey))));
TOLOG("---------");
//TOLOG(QString::fromStdString(base64_encode(m_header.szReserved, sizeof(m_header.szReserved))));
}
示例15: TOLOG
bool CWizSearchIndexer::_updateDocumentImpl(void *pHandle, const WIZDOCUMENTDATAEX& doc)
{
CWizDatabase& db = m_dbMgr.db(doc.strKbGUID);
db.setDocumentSearchIndexed(doc.strGUID, false);
QString strFileName = db.GetDocumentFileName(doc.strGUID);
// document data have not downloaded yet
if (!QFile::exists(strFileName)) {
return true;
}
// FIXME : deal with encrypted document
if (doc.nProtected) {
return true;
}
// decompress
QString strDataFile;
if (!db.DocumentToTempHtmlFile(doc, strDataFile)) {
TOLOG("Can't decompress document while update FTS index: " + doc.strTitle);
return false;
}
// get plain text content
QString strHtmlData;
if (!::WizLoadUnicodeTextFromFile(strDataFile, strHtmlData)) {
TOLOG("Can't load document data while update FTS index:" + doc.strTitle);
return false;
}
QString strPlainText;
::WizHtml2Text(strHtmlData, strPlainText);
if (strPlainText.isEmpty()) {
TOLOG("Html to text is failed: " + doc.strTitle);
return false;
}
bool ret = WizFTSUpdateDocument(pHandle, \
doc.strKbGUID.toStdWString().c_str(), \
doc.strGUID.toStdWString().c_str(), \
doc.strTitle.toStdWString().c_str(), \
strPlainText.toStdWString().c_str());
if (ret) {
db.setDocumentSearchIndexed(doc.strGUID, true);
}
return ret;
}