コード例 #1
0
ファイル: hqlesp.cpp プロジェクト: AttilaVamos/HPCC-Platform
void WebServicesExtractor::getAttributeText(StringBuffer & text, const char* attributeName)
{
    const char * dot = strrchr(attributeName, '.');
    if(!dot || !dot[1])
        throw MakeStringException(3, "Please specify both module and attribute");

    OwnedHqlExpr symbol = getResolveAttributeFullPath(attributeName, LSFpublic, lookupCtx); 
    if (!symbol || !hasNamedSymbol(symbol) || !symbol->hasText()) 
    {
        StringBuffer txt;
        txt.append("Could not read attribute: ").append(attributeName);
        DBGLOG("%s", txt.str());
        throw MakeStringException(ERR_NO_ATTRIBUTE_TEXT, "%s", txt.str());
    }

    symbol->getTextBuf(text);

    /* MORE: It would be preferable if this was better integrated with hqlgram2.cpp.  It's a reasonable stopgap */
    if (archive)
    {
        StringAttr moduleName(attributeName, dot-attributeName);
        IPropertyTree * moduleTree = queryEnsureArchiveModule(archive, moduleName, NULL);
        IPropertyTree * attrTree = queryArchiveAttribute(moduleTree, dot+1);
        if (!attrTree)
        {
            attrTree = createArchiveAttribute(moduleTree, dot+1);

            const char * p = text.str();
            if (0 == strncmp(p, UTF8_BOM,3))
                p += 3;
            attrTree->setProp("", p);
        }
    }
}
コード例 #2
0
JNIEXPORT jlong JNICALL
Java_org_apache_subversion_javahl_SVNClient_checkout
(JNIEnv *env, jobject jthis, jstring jmoduleName, jstring jdestPath,
 jobject jrevision, jobject jpegRevision, jobject jdepth,
 jboolean jignoreExternals, jboolean jallowUnverObstructions)
{
  JNIEntry(SVNClient, checkout);
  SVNClient *cl = SVNClient::getCppObject(jthis);
  if (cl == NULL)
    {
      JNIUtil::throwError(_("bad C++ this"));
      return -1;
    }
  Revision revision(jrevision, true);
  if (JNIUtil::isExceptionThrown())
    return -1;

  Revision pegRevision(jpegRevision, true);
  if (JNIUtil::isExceptionThrown())
    return -1;

  JNIStringHolder moduleName(jmoduleName);
  if (JNIUtil::isExceptionThrown())
    return -1;

  JNIStringHolder destPath(jdestPath);
  if (JNIUtil::isExceptionThrown())
    return -1;

  return cl->checkout(moduleName, destPath, revision, pegRevision,
                      EnumMapper::toDepth(jdepth),
                      jignoreExternals ? true : false,
                      jallowUnverObstructions ? true : false);
}
コード例 #3
0
ファイル: EditFiles.cpp プロジェクト: Purplenigma/oovaide
void EditFiles::viewModule(OovStringRef const fn, int lineNum)
    {
    FilePath moduleName(fn, FP_File);
    bool header = isCppHeader(fn);
    bool source = isCppSource(fn);

    if(header || source)
        {
        moduleName.appendExtension("h");
        if(header)
            viewFile(moduleName, lineNum);
        else
            viewFile(moduleName, 1);

        moduleName.appendExtension("cpp");
        if(source)
            viewFile(moduleName, lineNum);
        else
            viewFile(moduleName, 1);
        }
    else
        {
        viewFile(fn, lineNum);
        }
    }
コード例 #4
0
HMODULE ChildProcessManager::GetChildProcessMainModule() const
{
	HMODULE ret(NULL);

	if (IsChildProcessCreated())
	{
		HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
				FALSE,
				m_piProcInfo->dwProcessId
			);
		if (hProcess != INVALID_HANDLE_VALUE)
		{
			char lpBaseName[MAX_PATH];

			CProcessModuleIterator pmi(m_piProcInfo->dwProcessId);

			for (HMODULE hModule = pmi.First(); hModule; hModule = pmi.Next())
			{
				if (GetModuleBaseName(hProcess, hModule, lpBaseName, MAX_PATH))
				{
					std::string moduleName(lpBaseName);
					if (moduleName.find(".exe") != std::string::npos)
					{
						ret = hModule;
						break;
					}
				}
			}

			CloseHandle(hProcess);
		}
	}

	return ret;
}
コード例 #5
0
ファイル: EditFiles.cpp プロジェクト: 8l/oovcde
void EditFiles::viewModule(OovStringRef const fn, int lineNum)
    {
    FilePath moduleName(fn, FP_File);
    FilePath cppExt("cpp", FP_Ext);
    FilePath hExt("h", FP_Ext);
    bool header = moduleName.matchExtension(hExt);
    bool source = moduleName.matchExtension(cppExt);

    if(header || source)
        {
        moduleName.appendExtension("h");
        if(header)
            viewFile(moduleName, lineNum);
        else
            viewFile(moduleName, 1);

        moduleName.appendExtension("cpp");
        if(source)
            viewFile(moduleName, lineNum);
        else
            viewFile(moduleName, 1);
        }
    else
        {
        viewFile(fn, lineNum);
        }
    }
コード例 #6
0
ファイル: modulehandle.hpp プロジェクト: LeDYoM/sgh
		bool sameModuleInformation(const ModuleHandle &rh) const {
			return std::string(moduleName()) == std::string(rh.moduleName());

			// TO DO: Compare version numbers?
			// string(lh.version) == string(rh.version) &&
			// string(lh.subVersion) == string(rh.subVersion) &&
			// string(lh.patch) == string(rh.patch);
		}
コード例 #7
0
ファイル: CNFerModule.cpp プロジェクト: shabesoglu/smtrat
 CNFerModule::CNFerModule( const ModuleInput* _formula, RuntimeSettings*, Conditionals& _conditionals, Manager* const _manager ):
     PModule( _formula, _conditionals, _manager )
 {
     #ifdef SMTRAT_DEVOPTION_Statistics
     stringstream s;
     s << moduleName() << "_" << id();
     mpStatistics = new CNFerModuleStatistics( s.str() );
     #endif
 }
コード例 #8
0
ファイル: m_protocols.cpp プロジェクト: gloria8023/miranda-ng
static int lua_GetAccount(lua_State *L)
{
	ptrA moduleName(mir_utf8decodeA(luaL_checkstring(L, 1)));

	PROTOACCOUNT* pa = ::Proto_GetAccount(moduleName);
	if (pa)
		lua_pushlightuserdata(L, pa);
	else
		lua_pushnil(L);

	return 1;
}
コード例 #9
0
//-----------------------------------------------------------------------------
// CTestSDKDialogs::SendTestClassVersion
// Method used to send version of test class
//-----------------------------------------------------------------------------
//
void CTestSDKDialogs::SendTestClassVersion()
    {
    TVersion moduleVersion;
    moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
    moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
    moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
    
    _LIT( KFileName, "testsdkdialogs.dll" );
    TFileName moduleName( KFileName );

    TBool newVersionOfMethod = ETrue;
    TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
    }
コード例 #10
0
void LinguisticResourcesPrivate::
includeResources(Common::XMLConfigurationFiles::ModuleConfigurationStructure& module,
                 Common::XMLConfigurationFiles::ModuleConfigurationStructure& includeModule)
{   RESOURCESLOGINIT;
    try {
        deque<string> includeList=includeModule.getListValuesAtKeyOfGroupNamed("includeList","include");
        for (deque<string>::const_iterator it=includeList.begin(),
                it_end=includeList.end(); it!=it_end; it++) {
            string::size_type i=(*it).find("/");
            if (i==string::npos) {
                LERROR << "Cannot include resources " << *it
                       << ": must specify file and module name" << LENDL;
                continue;
            }
            string fileName(""),moduleName("");
            try {
                RESOURCESLOGINIT;
                LINFO << "i="<< i << LENDL;
                fileName=Common::MediaticData::MediaticData::single().getConfigPath()+
                         "/"+string((*it),0,i);
                LINFO << "filename="<< fileName << LENDL;
                moduleName=string((*it),i+1);
                LINFO << "moduleName="<< moduleName << LENDL;
                XMLConfigurationFileParser parser(fileName);
                ModuleConfigurationStructure& newMod=parser.getModuleConfiguration(moduleName);
                module.addModule(newMod);
                LINFO << "added module" << LENDL;
                ostringstream oss;
                for (ModuleConfigurationStructure::const_iterator it=module.begin(),it_end=module.end();
                        it!=it_end; it++) {
                    oss << (*it).first << ";";
                }
                LINFO << "module contain following groups: " << oss.str() << LENDL;
                // recursive inclusions
                includeResources(module,newMod);
            }
            catch(NoSuchModule& ) {
                RESOURCESLOGINIT;
                LERROR << "Cannot find module " << moduleName
                       << " in file " << fileName << LENDL;
            }
            catch(exception& e) {
                RESOURCESLOGINIT;
                LERROR << "Error trying to find module " << moduleName
                       << " in file " << fileName << ":" << e.what() << LENDL;
            }
        }
    }
    catch(NoSuchList& ) { } // do nothing: optional
    catch(NoSuchGroup& ) { } // do nothing: optional
}
コード例 #11
0
ファイル: ZoneGraph.cpp プロジェクト: animatedb/oovaide
std::string ZoneGraph::getComponentText(ModelModule const *modelModule)
    {
    OovString relFile = Project::getSrcRootDirRelativeSrcFileName(
            modelModule->getName(), Project::getSrcRootDirectory());
    FilePath moduleName(relFile, FP_File);
    moduleName.discardFilename();
    /// @todo - FilePath doesn't have a good way to remove a trailing slash
    /// since it wants to reserve the indication of directory
    std::string name = moduleName;
    int pos = name.length()-1;
    if(name[pos] == '/')
        name.erase(pos);
    return name;
    }
コード例 #12
0
ファイル: ModuleManager.cpp プロジェクト: aronarts/FireNET
void CFlowGraphModuleManager::ScanFolder(const string& folderName, bool bGlobal)
{
	_finddata_t fd;
	intptr_t handle = 0;
	ICryPak *pPak = gEnv->pCryPak;

	CryFixedStringT<512> searchString = folderName.c_str();
	searchString.append("*.*");

	handle = pPak->FindFirst(searchString.c_str(), &fd);

	CryFixedStringT<512> moduleName("");
	string newFolder("");

	if (handle > -1)
	{
		do
		{
			if (!strcmp(fd.name, ".") || !strcmp(fd.name, "..") || (fd.attrib & _A_HIDDEN))
				continue;

			if (fd.attrib & _A_SUBDIR)
			{
				newFolder = folderName;
				newFolder = newFolder + fd.name;
				newFolder = newFolder + "\\";
				ScanFolder(newFolder, bGlobal);
			}
			else
			{
				moduleName = fd.name;
				if(!strcmpi(PathUtil::GetExt(moduleName.c_str()), "xml"))
				{
					PathUtil::RemoveExtension(moduleName);
					PathUtil::MakeGamePath(folderName);

					// initial load: creates module, registers nodes
					CFlowGraphModule* pModule = PreLoadModuleFile(moduleName.c_str(), PathUtil::GetPath(folderName)+fd.name, bGlobal);
					// important: the module should be added using its internal name rather than the filename
					m_ModulesPathInfo.insert(TModulesPathInfo::value_type(pModule->GetName(), PathUtil::GetPath(folderName)+fd.name));
				}
			}

		} while (pPak->FindNext(handle, &fd) >= 0);

		pPak->FindClose(handle);
	}
}
コード例 #13
0
// #################################################################################################
// Constructors/destructor
// #################################################################################################
AWorxUnitTesting::AWorxUnitTesting( const TString& domain, const TString& testName)
: lox( "UTLox", false )
{
    this->domain=       domain;
    this->actTestName=  testName;

    Log_SetSourcePathTrimRule( "*/src.cpp/", Inclusion::Include );

    #if defined ( ALIB_VSTUDIO )
        utl= new UTVStudioLogger();
    #else
//! [IDESetupGuide_ADD_ABSOLUTE_PATH]
        utl= Lox::CreateConsoleLogger();

        // if QTCreator with QMake was detected, then use absolute paths
        if( utl->MetaInfo->Format.IndexOf( "   Loc:" ) >= 0  )
        {
            Directory moduleName( Directory::SpecialFolder::Module );
            int idx= moduleName.Path.IndexOf( "/ALox/" );
            if ( idx > 0 )
            {
                moduleName.Path.SetLength( idx + 5 );
                lox.ClearSourcePathTrimRules( Reach::Global, false );
                lox.SetSourcePathTrimRule( "*/src.cpp/", Inclusion::Exclude, 0, Case::Ignore, moduleName.Path,
                                           Reach::Global  );
            }
        }
//! [IDESetupGuide_ADD_ABSOLUTE_PATH]
    #endif

    if ( LastAutoSizes.IsNotEmpty() )
    {
        utl->AutoSizes.Import( LastAutoSizes, CurrentData::Keep );
    }

    lox.SetScopeInfo(ALIB_SRC_INFO_PARAMS);
        lox.SetVerbosity( utl, Verbosity::Verbose, domain);
        lox.SetVerbosity( utl, Verbosity::Warning, ALox::InternalDomains );
        lox.SetPrefix( ESC::BG_GRAY, "/" );
    lox.Release();

    lib::Report::GetDefault().PushWriter( this );

}
コード例 #14
0
ファイル: nsCrypto.cpp プロジェクト: MichaelKohler/gecko-dev
// Add a new PKCS11 module to the user's profile.
NS_IMETHODIMP
nsPkcs11::AddModule(const nsAString& aModuleName,
                    const nsAString& aLibraryFullPath,
                    int32_t aCryptoMechanismFlags,
                    int32_t aCipherFlags)
{
  nsNSSShutDownPreventionLock locker;
  if (isAlreadyShutDown()) {
    return NS_ERROR_NOT_AVAILABLE;
  }

  if (aModuleName.IsEmpty()) {
    return NS_ERROR_INVALID_ARG;
  }

  NS_ConvertUTF16toUTF8 moduleName(aModuleName);
  nsCString fullPath;
  // NSS doesn't support Unicode path.  Use native charset
  NS_CopyUnicodeToNative(aLibraryFullPath, fullPath);
  uint32_t mechFlags = SECMOD_PubMechFlagstoInternal(aCryptoMechanismFlags);
  uint32_t cipherFlags = SECMOD_PubCipherFlagstoInternal(aCipherFlags);
  SECStatus srv = SECMOD_AddNewModule(moduleName.get(), fullPath.get(),
                                      mechFlags, cipherFlags);
  if (srv != SECSuccess) {
    return NS_ERROR_FAILURE;
  }

#ifndef MOZ_NO_SMART_CARDS
  mozilla::UniqueSECMODModule module(SECMOD_FindModule(moduleName.get()));
  if (!module) {
    return NS_ERROR_FAILURE;
  }
  nsCOMPtr<nsINSSComponent> nssComponent(
    do_GetService(PSM_COMPONENT_CONTRACTID));
  nssComponent->LaunchSmartCardThread(module.get());
#endif

  return NS_OK;
}
コード例 #15
0
ファイル: nsCrypto.cpp プロジェクト: MichaelKohler/gecko-dev
// Delete a PKCS11 module from the user's profile.
NS_IMETHODIMP
nsPkcs11::DeleteModule(const nsAString& aModuleName)
{
  nsNSSShutDownPreventionLock locker;
  if (isAlreadyShutDown()) {
    return NS_ERROR_NOT_AVAILABLE;
  }

  if (aModuleName.IsEmpty()) {
    return NS_ERROR_INVALID_ARG;
  }

  NS_ConvertUTF16toUTF8 moduleName(aModuleName);
  // Introduce additional scope for module so all references to it are released
  // before we call SECMOD_DeleteModule, below.
#ifndef MOZ_NO_SMART_CARDS
  {
    mozilla::UniqueSECMODModule module(SECMOD_FindModule(moduleName.get()));
    if (!module) {
      return NS_ERROR_FAILURE;
    }
    nsCOMPtr<nsINSSComponent> nssComponent(
      do_GetService(PSM_COMPONENT_CONTRACTID));
    nssComponent->ShutdownSmartCardThread(module.get());
  }
#endif

  // modType is an output variable. We ignore it.
  int32_t modType;
  SECStatus srv = SECMOD_DeleteModule(moduleName.get(), &modType);
  if (srv != SECSuccess) {
    return NS_ERROR_FAILURE;
  }

  return NS_OK;
}
コード例 #16
0
// TODO(jat): remove suppliedUrl and update hosted.html API
NS_IMETHODIMP ExternalWrapper::Connect(const nsACString& suppliedUrl,
                                       const nsACString& sessionKey, const nsACString& aAddr,
                                       const nsACString& aModuleName, const nsACString& hostedHtmlVersion,
                                       PRBool *_retval) {
    Debug::log(Debug::Info) << "Connect(url=" <<  url << ", sessionKey="
                            << sessionKey << ", address=" << aAddr << ", module=" << aModuleName
                            << ", hostedHtmlVersion=" << hostedHtmlVersion << Debug::flush;

    // TODO: string utilities?
    nsCString urlAutoStr;
    NS_UTF16ToCString(url, NS_CSTRING_ENCODING_UTF8, urlAutoStr);
    nsCString sessionKeyAutoStr(sessionKey);
    nsCString addrAutoStr(aAddr);
    nsCString moduleAutoStr(aModuleName);
    nsCString hostedHtmlVersionAutoStr(hostedHtmlVersion);
    std::string hostedUrl(addrAutoStr.get());
    std::string urlStr(urlAutoStr.get());

    bool allowed = false;
    std::string webHost = AllowedConnections::getHostFromUrl(urlStr);
    std::string codeServer = AllowedConnections::getCodeServerFromUrl(urlStr);
    if (!AllowedConnections::matchesRule( webHost, codeServer, &allowed)) {
        // If we didn't match an existing rule, prompt the user
        allowed = askUserToAllow(urlStr);
    }
    if (!allowed) {
        *_retval = false;
        return NS_OK;
    }

    size_t index = hostedUrl.find(':');
    if (index == std::string::npos) {
        *_retval = false;
        return NS_OK;
    }
    std::string hostPart = hostedUrl.substr(0, index);
    std::string portPart = hostedUrl.substr(index + 1);

    // TODO(jat): leaks HostChannel -- need to save it in a session object and
    // return that so the host page can call a disconnect method on it at unload
    // time or when it gets GC'd.
    HostChannel* channel = new HostChannel();

    Debug::log(Debug::Debugging) << "Connecting..." << Debug::flush;

    if (!channel->connectToHost(hostPart.c_str(),
                                atoi(portPart.c_str()))) {
        *_retval = false;
        return NS_OK;
    }

    Debug::log(Debug::Debugging) << "...Connected" << Debug::flush;
    sessionHandler.reset(new FFSessionHandler(channel/*, ctx*/));

    std::string hostedHtmlVersionStr(hostedHtmlVersionAutoStr.get());
    if (!channel->init(sessionHandler.get(), BROWSERCHANNEL_PROTOCOL_VERSION,
                       BROWSERCHANNEL_PROTOCOL_VERSION, hostedHtmlVersionStr)) {
        *_retval = false;
        return NS_OK;
    }

    std::string moduleName(moduleAutoStr.get());
    std::string userAgent;

    // get the user agent
    nsresult res = getUserAgent(userAgent);
    if (NS_FAILED(res)) {
        return res;
    }

    std::string tabKeyStr = computeTabIdentity();
    std::string sessionKeyStr(sessionKeyAutoStr.get());

    LoadModuleMessage::send(*channel, urlStr, tabKeyStr, sessionKeyStr,
                            moduleName, userAgent, sessionHandler.get());

    // TODO: return session object?
    *_retval = true;
    return NS_OK;
}
コード例 #17
0
ファイル: ModuleScope.cpp プロジェクト: PuerkitoBio/locic
		std::string ModuleScope::toString() const {
			return makeString("%s(name = %s, version = %s)",
				kindString().c_str(),
				moduleName().toString().c_str(),
				moduleVersion().toString().c_str());
		}
コード例 #18
0
ファイル: Registry.cpp プロジェクト: mikeconley/comm-central
HRESULT RegisterServer(const CLSID& clsid,         // Class ID
                       const char* szFriendlyName, // Friendly Name
                       const char* szVerIndProgID, // Programmatic
                       const char* szProgID)       //   IDs
{
    HMODULE hModule = GetModuleHandle(NULL);
    char szModuleName[MAX_SIZE];
    char szCLSID[CLSID_STRING_SIZE];

    nsCAutoString independentProgId(szVerIndProgID);
    nsCAutoString progId(szProgID);

    DWORD dwResult = ::GetModuleFileName(hModule, szModuleName,
                              sizeof(szModuleName)/sizeof(char));

    if (dwResult == 0)
        return S_FALSE;

    nsCAutoString moduleName(szModuleName);
    nsCAutoString registryKey("CLSID\\");

    moduleName += MAPI_STARTUP_ARG;

    // Convert the CLSID into a char.

    if (!CLSIDtochar(clsid, szCLSID, sizeof(szCLSID)))
        return S_FALSE;
    registryKey += szCLSID;

    // Add the CLSID to the registry.
    if (!setKeyAndValue(registryKey, NULL, szFriendlyName))
        return S_FALSE;

    if (!setKeyAndValue(registryKey, "LocalServer32", moduleName.get()))
        return S_FALSE;

    // Add the ProgID subkey under the CLSID key.
    if (!setKeyAndValue(registryKey, "ProgID", szProgID))
        return S_FALSE;

    // Add the version-independent ProgID subkey under CLSID key.
    if (!setKeyAndValue(registryKey, "VersionIndependentProgID", szVerIndProgID))
        return S_FALSE;

    // Add the version-independent ProgID subkey under HKEY_CLASSES_ROOT.
    if (!setKeyAndValue(independentProgId, NULL, szFriendlyName))
        return S_FALSE; 
    if (!setKeyAndValue(independentProgId, "CLSID", szCLSID))
        return S_FALSE;
    if (!setKeyAndValue(independentProgId, "CurVer", szProgID))
        return S_FALSE;

    // Add the versioned ProgID subkey under HKEY_CLASSES_ROOT.
    if (!setKeyAndValue(progId, NULL, szFriendlyName))
        return S_FALSE; 
    if (!setKeyAndValue(progId, "CLSID", szCLSID))
        return S_FALSE;

    RegisterProxy();

    return S_OK;
}
コード例 #19
0
QString SimModule::name() const
{
    return moduleName(_filename);
}
コード例 #20
0
ファイル: moecontentplugin.cpp プロジェクト: NexusTools/MOE
QString MoeContentPlugin::name() const{
    return moduleName();
}