⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 messageloader.cpp

📁 Pegasus is an open-source implementationof the DMTF CIM and WBEM standards. It is designed to be por
💻 CPP
📖 第 1 页 / 共 3 页
字号:
        }#endif#ifdef PEGASUS_OS_TYPE_UNIX        if (PEG_NOT_FOUND  != argv0.find('/'))        {            Uint32 command = argv0.reverseFind('/');            startingDir = argv0.subString(0, command+1);        }        else        {            if (FileSystem::existsNoCase(argv0))            {                FileSystem::getCurrentDirectory(startingDir);                startingDir.append("/");            }            else            {                String path;# ifdef PEGASUS_PLATFORM_OS400_ISERIES_IBM#  pragma convert(37)                const char* env = getenv("PATH");                if (env != NULL)                    EtoA((char*)env);#  pragma convert(0)# else                const char* env = getenv("PATH");# endif                if (env != NULL)                    path.assign(env);                String pathDelim = FileSystem::getPathDelimiter();                Uint32 size = path.size();                while (path.size() > 0)                {                    try                    {                        Uint32 delim = path.find(pathDelim);                        if (delim != PEG_NOT_FOUND)                        {                            pathDir = path.subString(0,delim);                            path.remove(0,(delim+1));                        }                        else                        {                            pathDir = path;                            path = "";                        }                        String commandPath = pathDir.append('/');                        commandPath = commandPath.append(argv0) ;                        Boolean dirContent =                            FileSystem::existsNoCase(commandPath);                        if (dirContent)                        {                            startingDir = pathDir;                            break;                        }                    }                    catch (Exception& e)                    {                        // Have to do nothing.                        // Catching the exception if there is any exception                        // while searching in the path variable                    }                }            }        }#endif        initPegasusMsgHome(startingDir);    }    catch (Exception& e)    {        // Have to do nothing.        // Catching the exception if there is any exception while searching        // in the path variable    }#endif}void MessageLoader::initPegasusMsgHome(const String& startDir){    String startingDir = startDir;    if (startingDir.size() == 0)    {#ifdef PEGASUS_PLATFORM_OS400_ISERIES_IBM# pragma convert(37)        const char* env = getenv("PEGASUS_MSG_HOME");        if (env != NULL)            EtoA((char*)env);# pragma convert(0)#else        const char* env = getenv("PEGASUS_MSG_HOME");#endif        if (env != NULL)            startingDir.assign(env);    }#ifdef PEGASUS_DEFAULT_MESSAGE_SOURCE    if (System::is_absolute_path(            (const char *)PEGASUS_DEFAULT_MESSAGE_SOURCE))    {        pegasus_MSG_HOME = PEGASUS_DEFAULT_MESSAGE_SOURCE;        pegasus_MSG_HOME.append('/');    }    else    {        if (startingDir.size() != 0)        {            pegasus_MSG_HOME = startingDir;            pegasus_MSG_HOME.append('/');        }        pegasus_MSG_HOME.append(PEGASUS_DEFAULT_MESSAGE_SOURCE);        pegasus_MSG_HOME.append('/');    }#else    if (startingDir.size() != 0)    {        pegasus_MSG_HOME = startingDir;        pegasus_MSG_HOME.append("/");    }    else    {         // Will use current working directory    }#endif    checkDefaultMsgLoading();}void MessageLoader::checkDefaultMsgLoading(){    // Note: this function is a special hook for the automated tests    // (poststarttests).  Since the automated tests expect the old hardcoded    // default messages, an env var will be used to tell this code to ignore    // ICU and return the default message.    // This will allow poststarttests to run with ICU installed.    // TODO: remove this function once test cases are compatible with ICU    // messages#ifdef PEGASUS_OS_OS400# pragma convert(37)#endif    const char* env = getenv("PEGASUS_USE_DEFAULT_MESSAGES");#ifdef PEGASUS_OS_OS400# pragma convert(0)#endif    if (env != NULL)        _useDefaultMsg = true;}MessageLoaderParms::MessageLoaderParms(){    useProcessLocale = false;    useThreadLocale = true;#ifdef PEGASUS_HAS_ICU    useICUfallback = false;#endif    acceptlanguages = AcceptLanguageList();    contentlanguages = ContentLanguageList();    _resbundl = NO_ICU_MAGIC;}MessageLoaderParms::MessageLoaderParms(    const String& id,    const String& msg,    const Formatter::Arg& arg0_,    const Formatter::Arg& arg1_,    const Formatter::Arg& arg2_,    const Formatter::Arg& arg3_,    const Formatter::Arg& arg4_,    const Formatter::Arg& arg5_,    const Formatter::Arg& arg6_,    const Formatter::Arg& arg7_,    const Formatter::Arg& arg8_,    const Formatter::Arg& arg9_){    msg_id = id;    default_msg = msg;    _init();    arg0 = arg0_;    arg1 = arg1_;    arg2 = arg2_;    arg3 = arg3_;    arg4 = arg4_;    arg5 = arg5_;    arg6 = arg6_;    arg7 = arg7_;    arg8 = arg8_;    arg9 = arg9_;}MessageLoaderParms::MessageLoaderParms(    const String& id,    const String& msg){    msg_id = id;    default_msg = msg;    _init();}MessageLoaderParms::MessageLoaderParms(    const String& id,    const String& msg,    const Formatter::Arg& arg0_){    msg_id = id;    default_msg = msg;    _init();    arg0 = arg0_;}MessageLoaderParms::MessageLoaderParms(    const String& id,    const String& msg,    const Formatter::Arg& arg0_,    const Formatter::Arg& arg1_){    msg_id = id;    default_msg = msg;    _init();    arg0 = arg0_;    arg1 = arg1_;}MessageLoaderParms::MessageLoaderParms(    const String& id,    const String& msg,    const Formatter::Arg& arg0_,    const Formatter::Arg& arg1_,    const Formatter::Arg& arg2_){    msg_id = id;    default_msg = msg;    _init();    arg0 = arg0_;    arg1 = arg1_;    arg2 = arg2_;}MessageLoaderParms::MessageLoaderParms(    const String& id,    const String& msg,    const Formatter::Arg& arg0_,    const Formatter::Arg& arg1_,    const Formatter::Arg& arg2_,    const Formatter::Arg& arg3_){    msg_id = id;    default_msg = msg;    _init();    arg0 = arg0_;    arg1 = arg1_;    arg2 = arg2_;    arg3 = arg3_;}MessageLoaderParms::MessageLoaderParms(    const char* id,    const char* msg){    msg_id = id;    default_msg = msg;    _init();}MessageLoaderParms::MessageLoaderParms(    const char* id,    const char* msg,    const String& arg0_){    msg_id = id;    default_msg = msg;    _init();    arg0 = arg0_;}MessageLoaderParms::MessageLoaderParms(    const char* id,    const char* msg,    const String& arg0_,    const String& arg1_){    msg_id = id;    default_msg = msg;    _init();    arg0 = arg0_;    arg1 = arg1_;}void MessageLoaderParms::_init(){    useProcessLocale = false;    useThreadLocale = true;#ifdef PEGASUS_HAS_ICU    useICUfallback = false;#endif    acceptlanguages.clear();    contentlanguages.clear();    arg0 = Formatter::DEFAULT_ARG;    arg1 = Formatter::DEFAULT_ARG;    arg2 = Formatter::DEFAULT_ARG;    arg3 = Formatter::DEFAULT_ARG;    arg4 = Formatter::DEFAULT_ARG;    arg5 = Formatter::DEFAULT_ARG;    arg6 = Formatter::DEFAULT_ARG;    arg7 = Formatter::DEFAULT_ARG;    arg8 = Formatter::DEFAULT_ARG;    arg9 = Formatter::DEFAULT_ARG;    _resbundl = NO_ICU_MAGIC;}String MessageLoaderParms::toString(){    String s;    String processLoc,threadLoc,ICUfallback;    processLoc = (useProcessLocale) ? "true" : "false";    threadLoc = (useThreadLocale) ? "true" : "false";#ifdef PEGASUS_HAS_ICU    ICUfallback = (useICUfallback) ? "true" : "false";#endif    s.append("msg_id = " + msg_id + "\n");    s.append("default_msg = " + default_msg + "\n");    s.append("msg_src_path = " + msg_src_path + "\n");    s.append("acceptlanguages = " +        LanguageParser::buildAcceptLanguageHeader(acceptlanguages) + "\n");    s.append("contentlanguages = " +        LanguageParser::buildContentLanguageHeader(contentlanguages) + "\n");    s.append("useProcessLocale = " + processLoc + "\n");    s.append("useThreadLocale = " + threadLoc + "\n");#ifdef PEGASUS_HAS_ICU    s.append("useICUfallback = " + ICUfallback + "\n");#endif    s.append(        "arg0 = " + arg0.toString() + "\n" +        "arg1 = " + arg1.toString() + "\n" +        "arg2 = " + arg2.toString() + "\n" +        "arg3 = " + arg3.toString() + "\n" +        "arg4 = " + arg4.toString() + "\n" +        "arg5 = " + arg5.toString() + "\n" +        "arg6 = " + arg6.toString() + "\n" +        "arg7 = " + arg7.toString() + "\n" +        "arg8 = " + arg8.toString() + "\n" +        "arg9 = " + arg9.toString() + "\n\n");    return s;}MessageLoaderParms::~MessageLoaderParms(){}PEGASUS_NAMESPACE_END

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -