コード例 #1
0
ファイル: predicateparse.cpp プロジェクト: CDrummond/cantata
void PredicateParse_destroy(void *pred)
{
    Solid::PredicateParse::ParsingData *data = s_parsingData->localData();
    Solid::Predicate *p = (Solid::Predicate *) pred;
    if (p != data->result) {
        delete p;
    }
}
コード例 #2
0
void QXmlSchemaPrivate::load(const QByteArray &data, const QUrl &documentUri, const QString &targetNamespace)
{
    QByteArray localData(data);

    QBuffer buffer(&localData);
    buffer.open(QIODevice::ReadOnly);

    load(&buffer, documentUri, targetNamespace);
}
コード例 #3
0
ファイル: qxmlschemavalidator.cpp プロジェクト: kileven/qt5
/*!
  Validates the XML instance document read from \a data with the
  given \a documentUri against the schema.

  Returns \c true if the XML instance document is valid according to the
  schema, \c false otherwise.

  Example:

  \snippet qxmlschemavalidator/main.cpp 2
 */
bool QXmlSchemaValidator::validate(const QByteArray &data, const QUrl &documentUri) const
{
    QByteArray localData(data);

    QBuffer buffer(&localData);
    buffer.open(QIODevice::ReadOnly);

    return validate(&buffer, documentUri);
}
コード例 #4
0
QSharedPointer<QNetworkAccessManager> EnginioClientConnectionPrivate::prepareNetworkManagerInThread()
{
    QSharedPointer<QNetworkAccessManager> qnam;
    qnam = NetworkManager->localData().toStrongRef();
    if (!qnam) {
        qnam = QSharedPointer<QNetworkAccessManager>(new QNetworkAccessManager());
#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0) && !defined(QT_NO_SSL) && !defined(ENGINIO_VALGRIND_DEBUG)
        qnam->connectToHostEncrypted(EnginioString::apiEnginIo);
#endif
        NetworkManager->setLocalData(qnam);
    }
    return qnam;
}
コード例 #5
0
ファイル: enginioclient.cpp プロジェクト: jbache/enginio-qt
QNetworkAccessManager *EnginioClientPrivate::prepareNetworkManagerInThread()
{
    QNetworkAccessManager *qnam;
    qnam = NetworkManager->localData();
    if (!qnam) {
        qnam = new QNetworkAccessManager(); // it will be deleted by QThreadStorage.
#if QT_VERSION >= QT_VERSION_CHECK(5, 2, 0)
        qnam->connectToHostEncrypted(EnginioString::apiEnginIo);
#endif
        NetworkManager->setLocalData(qnam);
    }
    return qnam;
}
コード例 #6
0
ファイル: JSCCharacterData.cpp プロジェクト: bjqiwei/uscxml
bool JSCCharacterData::dataAttrSetter(JSContextRef ctx, JSObjectRef thisObj, JSStringRef propertyName, JSValueRef value, JSValueRef* exception) {
	struct JSCCharacterDataPrivate* privData = (struct JSCCharacterDataPrivate*)JSObjectGetPrivate(thisObj);

	JSStringRef stringReflocalData = JSValueToStringCopy(ctx, value, exception);
	size_t localDataMaxSize = JSStringGetMaximumUTF8CStringSize(stringReflocalData);
	char* localDataBuffer = new char[localDataMaxSize];
	JSStringGetUTF8CString(stringReflocalData, localDataBuffer, localDataMaxSize);
	std::string localData(localDataBuffer);
	JSStringRelease(stringReflocalData);
	free(localDataBuffer);

	privData->nativeObj->setData(localData);
	return true;
}
コード例 #7
0
ファイル: predicateparse.cpp プロジェクト: CDrummond/cantata
void *PredicateParse_newOr(void *pred1, void *pred2)
{
    Solid::Predicate *result = new Solid::Predicate();

    Solid::PredicateParse::ParsingData *data = s_parsingData->localData();
    Solid::Predicate *p1 = (Solid::Predicate *)pred1;
    Solid::Predicate *p2 = (Solid::Predicate *)pred2;

    if (p1==data->result || p2==data->result) {
        data->result = nullptr;
    }

    *result = *p1 | *p2;

    delete p1;
    delete p2;

    return result;
}
コード例 #8
0
ファイル: V8Document.cpp プロジェクト: fabioduque/uscxml
v8::Handle<v8::Value> V8Document::createCDATASectionCallback(const v8::Arguments& args) {
	if (args.Length() < 1)
		throw V8Exception("Wrong number of arguments in createCDATASection");

	v8::Local<v8::Object> self = args.Holder();
	struct V8DocumentPrivate* privData = V8DOM::toClassPtr<V8DocumentPrivate >(self->GetInternalField(0));
	v8::String::AsciiValue localData(args[0]);

	Arabica::DOM::CDATASection<std::string>* retVal = new Arabica::DOM::CDATASection<std::string>(privData->nativeObj->createCDATASection(*localData));
	v8::Handle<v8::Function> retCtor = V8CDATASection::getTmpl()->GetFunction();
	v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance());

	struct V8CDATASection::V8CDATASectionPrivate* retPrivData = new V8CDATASection::V8CDATASectionPrivate();
	retPrivData->dom = privData->dom;
	retPrivData->nativeObj = retVal;

	retObj->SetInternalField(0, V8DOM::toExternal(retPrivData));

	retObj.MakeWeak(0, V8CDATASection::jsDestructor);
	return retObj;

}
コード例 #9
0
ファイル: V8CharacterData.cpp プロジェクト: bjqiwei/uscxml
void V8CharacterData::dataAttrSetter(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) {
	v8::Local<v8::Object> self = info.Holder();
	struct V8CharacterDataPrivate* privData = V8DOM::toClassPtr<V8CharacterDataPrivate >(self->GetInternalField(0));
	v8::String::AsciiValue localData(value);
	privData->nativeObj->setData(*localData);
}
コード例 #10
0
//
// TABLE LEVEL output of auditdb command. 
// ***Only one table and one file in the auditdb arguments can be specified***
//
// It might throw the exception CeSqlException if fail in querying something from Ingres Database.
// If you have the list of columns, then provide it !.
// If the list of columns is null, then the function will query the list of columns !
// strTempTable [OUT]: receives the output of the temporary table name
BOOL IJA_TableAuditdbOutput (
    CaQueryTransactionInfo* pQueryInfo,
    CaTemporarySession* pSession, 
    CString& strTempTable, 
    CTypedPtrList<CObList, CaColumn*>* pListColumn,
	CString& strGranteeList)
{
	CString strDatabase;
	CString strDatabaseOwner;
	CString strTable;
	CString strTableOwner;
	CString strStatement;
	CString strLocalIngresTemp = theApp.m_strLocalIITemporary;
	if (strLocalIngresTemp.IsEmpty())
		return FALSE;
#ifdef MAINWIN
	strLocalIngresTemp += _T("/");
#else
	strLocalIngresTemp += _T("\\");
#endif

	class CaLocalData
	{
	public:
		CaLocalData(BOOL bLocal):m_bLocal(bLocal), m_strFile(_T("")){}
		virtual ~CaLocalData()
		{
			while (!m_listObject.IsEmpty())
				delete m_listObject.RemoveHead();
			//
			// Prepare to delete the files (*.trl) outputed from AUDITDB:
			if (m_bLocal)
			{
				if (!m_strFile.IsEmpty() && (_taccess(m_strFile, 0) != -1))
					DeleteFile (m_strFile);
			}
		};
		
		BOOL m_bLocal;
		CString m_strFile;
		CTypedPtrList<CObList, CaColumn*> m_listObject;
	};
	//
	// On the local node, do not use the remote command (RMCMD)
	BOOL bOnLocal = pSession->IsLocalNode();
	
	CaLocalData localData(bOnLocal);
	BOOL bQueryColumns = pListColumn? FALSE: TRUE;
	if (bQueryColumns)
	{
		if (IJA_QueryColumn (pQueryInfo, localData.m_listObject))
			pListColumn = &(localData.m_listObject);
	}

	CString csRmcmdOutPut;
	BOOL bResult = TRUE;

	ASSERT (pSession);
	if (!pSession)
		return FALSE;

	pQueryInfo->GetTable (strTable, strTableOwner);
	//
	// Get temp table name
	if (!GetTempAuditTableName(strTempTable, (LPCTSTR)strTable, (LPCTSTR)pQueryInfo->GetConnectedUser()))
	{
		//
		// Error while generating a temporary file name.
		CString strMsg;
		strMsg.LoadString(IDS_FAIL_TO_GENERATE_TEMPFILE);
		
		AfxMessageBox (strMsg);
		return FALSE;
	}
	
	//
	// Generate & Create the table to contain the audited table rows:
	// -------------------------------------------------------------
	CString strSyntaxCreateTable;
	BOOL bCreate = RCRD_GenerateTemporaryTableSyntax((LPCTSTR)strTempTable, pListColumn, strSyntaxCreateTable, bOnLocal);
	if (!bCreate) 
	{
		CString strMsg;
		strMsg.LoadString(IDS_FAIL_TO_GENERATE_TEMPTABLE);

		AfxMessageBox (strMsg);
		return FALSE;
	}
	CaLowlevelAddAlterDrop param (pQueryInfo->GetNode(), strDatabase, strSyntaxCreateTable);

	//
	// Create the temporary table in the current session:
	// --------------------------------------------------
	param.NeedSession(FALSE);
	//
	// This function will throw exception if failed:
	bCreate = param.ExecuteStatement(NULL);

	if (!bOnLocal)
	{
		param.SetStatement(_T("commit"));
		//
		// This function will throw exception if failed:
		bCreate = param.ExecuteStatement(NULL);
		if (!strGranteeList.IsEmpty()) {
			CString csStatement;
			csStatement.Format("grant select on %s to %s",(LPCTSTR)strTempTable, (LPCTSTR) strGranteeList);
			param.SetStatement((LPCTSTR)csStatement);
			// This function will throw exception in case of failure
			bCreate = param.ExecuteStatement(NULL);
			param.SetStatement(_T("commit"));
			// This function will throw exception in case of failure
			bCreate = param.ExecuteStatement(NULL);
		}
	}

	//
	// Construct parameters for the need of generating AUDITDB Syntax:
	CString strFile;
	CStringList listFile;
	CTypedPtrList < CObList, CaIjaTable* > listTable;
	
	//
	// TODO: Construct the directory path on the local machine:
	//       On remote machine the file name is generate by the utility adbtofst on NT machine
	//       or used the pipe on unix machine see adbtofst 
	if (!bOnLocal)
	{
		strFile = _T("");
	}
	else
	{

		CString strAcceptedFileName = strTempTable;
		MakeFileName(strAcceptedFileName);

		strFile.Format (_T("%s%s.trl"), (LPCTSTR)strLocalIngresTemp, (LPCTSTR)strAcceptedFileName);
	}

	listFile.AddTail (strFile);
	listTable.AddTail (new CaIjaTable(strTable, strTableOwner));
	localData.m_strFile = strFile;
	//
	// Generate AUDITDB syntax:
	BOOL bSyntax = FALSE; // FALSE generate syntax for the standard auditdb command
	                      // TRUE  generate syntax for adbtofst
	if (!bOnLocal)
		bSyntax = TRUE;

	RCRD_GenerateAuditdbSyntax (pQueryInfo, listTable, listFile, strStatement, pQueryInfo->GetConnectedUser(),bSyntax);
	while (!listTable.IsEmpty())
		delete listTable.RemoveHead();

	if (bOnLocal) 
	{
		CString strError = _T("");
		//
		// Execute the AUDITDB command:
		bCreate = PROCESS_Execute (strStatement, strError);
		if (!bCreate) 
		{
			if (!strError.IsEmpty())
				AfxMessageBox (strError);
			return FALSE;
		}
		//
		// Check if the file has been successfuly created:
		if (_taccess(strFile, 0) == -1)
		{
			//
			// auditdb ...-file=<file name>, has failed to create file.
			CString strMsg;
			strMsg.LoadString(IDS_AUDITDB_FAILS_TO_CREATE_FILE);

			AfxMessageBox (strMsg);
			return FALSE;
		}
		//
		// Copy the binary data of audited table to the newly created Table:
		strStatement.Format (
			_T("copy table session.%s () from '%s'"), 
			(LPCTSTR)strTempTable,
			(LPCTSTR)strFile);
		param.SetStatement(strStatement);

		//
		// This function will throw exception if failed:
		param.ExecuteStatement(NULL);
		param.SetStatement(_T("commit")); // the table is temporary anyhow. need to commit because of potential "set session authorization" statements
		bCreate = param.ExecuteStatement(NULL);
	}
	else
	//
	// Execute ADBTOFST at the remote machine through RMCMD:
	{
		//
		// At this point, it requires that no sessions are opened !
		pSession->Release();
		
		//Generate adbtofst syntax
		CString AdbToFstSyntax;
		CString strDatabase;
		CString strDatabaseOwner;

		pQueryInfo->GetDatabase (strDatabase, strDatabaseOwner);

		AdbToFstSyntax.Format(_T("adbtofst -u%s %s %s %s"),
		    (LPCTSTR)pQueryInfo->GetConnectedUser(),
		    (LPCTSTR)strTempTable,(LPCTSTR)strDatabase,
		    (LPCTSTR)strStatement);
		//
		// Execute the ADBTOFST command on the remote machine:
		bCreate = ExecRmcmdTestOutPut ((LPTSTR)(LPCTSTR)pQueryInfo->GetNode(), (LPTSTR)(LPCTSTR)AdbToFstSyntax,CMD_FASTLOAD,csRmcmdOutPut); 
		if (!bCreate) {
			//
			// Error While executing the AdbToFst Command:\n\n%1
			CString strMsg;
			if (csRmcmdOutPut.Find("E_DM1601_FLOAD_OPEN_DB")>=0)
				AfxFormatString1(strMsg, IDS_FAIL_TO_EXECUTE_ADBTOFST, (LPCTSTR)csRmcmdOutPut);
			else 
				strMsg = csRmcmdOutPut;
			AfxMessageBox (strMsg);
			DropTempTable(pSession, (LPCTSTR)strTempTable, bOnLocal);
			return FALSE;
		}

		//
		// Reopen the previous session:
		pSession->Open();
		if (!pSession->IsConnected())
		{
			//
			// Failedto get Session.
			CString strMsg;
			strMsg.LoadString (IDS_FAIL_TO_GETSESSION);
			AfxMessageBox (strMsg);

			DropTempTable(pSession, (LPCTSTR)strTempTable, bOnLocal);
			return FALSE;
		}
		param.NeedSession(FALSE);
	}

	return TRUE;
}
コード例 #11
0
ファイル: predicateparse.cpp プロジェクト: CDrummond/cantata
void PredicateParse_errorDetected(const char* s)
{
    qWarning("ERROR from solid predicate parser: %s", s);
    s_parsingData->localData()->result = nullptr;
}
コード例 #12
0
ファイル: predicateparse.cpp プロジェクト: CDrummond/cantata
void PredicateParse_setResult(void *result)
{
    Solid::PredicateParse::ParsingData *data = s_parsingData->localData();
    data->result = (Solid::Predicate *) result;
}
コード例 #13
0
ファイル: predicateparse.cpp プロジェクト: CDrummond/cantata
void PredicateLexer_unknownToken(const char* text)
{
    qWarning("ERROR from solid predicate parser: unrecognized token '%s' in predicate '%s'\n",
             text, s_parsingData->localData()->buffer.constData());
}
コード例 #14
0
bool idTypeDefBool::VerifyData( const char* data ) const {
	idStr localData( data );

	return !localData.Icmp("1") || !localData.Icmp("0") || !localData.Icmp("true") || !localData.Icmp("false");
}