• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PANTHEIOS_LITERAL_STRING函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中PANTHEIOS_LITERAL_STRING函数的典型用法代码示例。如果您正苦于以下问题:C++ PANTHEIOS_LITERAL_STRING函数的具体用法?C++ PANTHEIOS_LITERAL_STRING怎么用?C++ PANTHEIOS_LITERAL_STRING使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了PANTHEIOS_LITERAL_STRING函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: pan_get_hid_

static string_t pan_get_hid_()
{
#if defined(PLATFORMSTL_OS_IS_UNIX)

    PAN_CHAR_T  szHostName[1001];

    if(0 != ::gethostname(&szHostName[0], STLSOFT_NUM_ELEMENTS(szHostName)))
    {
        return PANTHEIOS_LITERAL_STRING("localhost");
    }
    else
    {
        return szHostName;
    }

#elif defined(PLATFORMSTL_OS_IS_WINDOWS)

    PAN_CHAR_T  szHostName[1001];
    DWORD       cchHostName = STLSOFT_NUM_ELEMENTS(szHostName);

    if(!pantheios_GetComputerName_(&szHostName[0], &cchHostName))
    {
        return PANTHEIOS_LITERAL_STRING("localhost");
    }
    else
    {
        return string_t(szHostName, static_cast<size_t>(cchHostName));
    }

#else /* ? OS */

# error Not discriminated for platforms other than UNIX and Windows

#endif /* OS */
}
开发者ID:wqjkdqj,项目名称:Palabos,代码行数:35,代码来源:test.unit.util.gethostname.cpp


示例2: test_win_F_HIDE_TIME

static void test_win_F_HIDE_TIME()
{
    const int   timeFlags   =   0
                            |   0
                            |   PANTHEIOS_GETCURRENTTIME_F_HIDE_TIME
                            |   0;

    pan_beutil_time_t   tm(0, NULL);
    size_t              expected = pantheios_util_getCurrentTime(&tm, timeFlags);

        PANTHEIOS_TEST_TIME(            0, timeFlags, expected, PANTHEIOS_LITERAL_STRING(""));
    { for(size_t i = 1; i < expected + 100; ++i)
    {
        PANTHEIOS_TEST_TIME( expected + i, timeFlags, expected, PANTHEIOS_LITERAL_STRING("*"));
    }}
}
开发者ID:synesissoftware,项目名称:Pantheios,代码行数:16,代码来源:test.unit.util.getcurrenttime.cpp


示例3: pan_slice_t

int be_fprintf_Context::rawLogEntry(
    int                 severity4
,   int                 /* severityX */
,   const pan_slice_t   (&ar)[rawLogArrayDimension]
,   size_t              /* cchTotal */
)
{
    PANTHEIOS_CONTRACT_ENFORCE_PRECONDITION_PARAMS_INTERNAL(severity4 >= 0, "severity must be >= 0");
    PANTHEIOS_CONTRACT_ENFORCE_PRECONDITION_PARAMS_INTERNAL(severity4 < 16, "severity must be < 16");

    // select the stream: stdout for debug/info/notice; stderr for everything else

    FILE* const         stm     =   deduce_stm_(severity4);
    const PAN_CHAR_T    fmt[]   =   PANTHEIOS_LITERAL_STRING("%.*s%.*s%.*s%.*s%.*s%.*s%.*s%.*s%.*s%.*s\n");

    STLSOFT_STATIC_ASSERT(4 * rawLogArrayDimension + 2 == STLSOFT_NUM_ELEMENTS(fmt));

    // fprintf the array of slices

#define PAN_BE_GET_SLICE_4_PRINTF(x)    int(x.len), x.ptr

    return pan_fprintf_(stm, fmt
                    ,   PAN_BE_GET_SLICE_4_PRINTF(ar[0])
                    ,   PAN_BE_GET_SLICE_4_PRINTF(ar[1])
                    ,   PAN_BE_GET_SLICE_4_PRINTF(ar[2])
                    ,   PAN_BE_GET_SLICE_4_PRINTF(ar[3])
                    ,   PAN_BE_GET_SLICE_4_PRINTF(ar[4])
                    ,   PAN_BE_GET_SLICE_4_PRINTF(ar[5])
                    ,   PAN_BE_GET_SLICE_4_PRINTF(ar[6])
                    ,   PAN_BE_GET_SLICE_4_PRINTF(ar[7])
                    ,   PAN_BE_GET_SLICE_4_PRINTF(ar[8])
                    ,   PAN_BE_GET_SLICE_4_PRINTF(ar[9]));
}
开发者ID:DoraXBMC,项目名称:Pantheios,代码行数:33,代码来源:bec.fprintf.cpp


示例4: test_1_01

static void test_1_01()
{
    PAN_CHAR_T      hostname[1000];
    const string_t  hid = pan_get_hid_();

    { for(size_t i = 0; i != STLSOFT_NUM_ELEMENTS(hostname); ++i)
    {
        ::memset(&hostname[0], 0, sizeof(hostname));

        const size_t len = pantheios::getHostName(&hostname[0], i);

        if(len == i)
        {
            // The function did not have enough space to write in, so it
            // will return the length passed to it ...
            XTESTS_TEST_INTEGER_EQUAL(i, len);
            // ... and will not have written anything to the file
            XTESTS_TEST_STRING_EQUAL(PANTHEIOS_LITERAL_STRING(""), hostname);
        }
        else
        {
            // The function had enough space, so it will return the length
            // of the intended hostname ...
            XTESTS_TEST_INTEGER_EQUAL(hid.size(), len);
            // ... and will have written the hostname
            XTESTS_TEST_STRING_EQUAL(hid, hostname);
        }
    }}
}
开发者ID:wqjkdqj,项目名称:Palabos,代码行数:29,代码来源:test.unit.util.gethostname.cpp


示例5: main

int main()
{
  /* Must initialise Pantheios, when using from C (and there are no C++
   * compilation units in the link-unit).
   *
   * If this is not done, undefined behaviour will ensue ...
   */
  if(pantheios_init() < 0)
  {
    return EXIT_FAILURE;
  }
  else
  {
    int   i = 123;
    float f = 99.99f;

    /* Log the int and the float: Output: "int=123, float=99.99"
     */
    pantheios_logprintf(PANTHEIOS_SEV_INFORMATIONAL
                      , PANTHEIOS_LITERAL_STRING("int=%d, float=%g")
                      , i, f);

    /* Must uninitialise Pantheios.
     *
     * pantheios_uninit() must be called once for each successful (>=0)
     * invocation of pantheios_init().
     */
    pantheios_uninit();

    return EXIT_SUCCESS;
  }
}
开发者ID:dlex,项目名称:pantheios,代码行数:32,代码来源:example.c.core.pantheios_logprintf.c


示例6: PANTHEIOS_CALL

PANTHEIOS_CALL(int) pantheios_be_speech_parseArgs(
    size_t                  numArgs
,   pan_slice_t* const      args
,   pan_be_speech_init_t*   init
)
{
    PANTHEIOS_CONTRACT_ENFORCE_PRECONDITION_PARAMS_API((NULL != args || 0 == numArgs), "argument pointer must be non-null, or number of arguments must be 0");
    PANTHEIOS_CONTRACT_ENFORCE_PRECONDITION_PARAMS_API(NULL != init, "initialisation structure pointer may not be null");

    pantheios_be_speech_getDefaultAppInit(init);

    // 1. Parse the stock arguments
    int res = pantheios_be_parseStockArgs(numArgs, args, &init->flags);

    if(res >= 0)
    {
        // 2.a Parse the custom argument: "synchronous"
        res = pantheios_be_parseBooleanArg(numArgs, args, PANTHEIOS_LITERAL_STRING("synchronous"), true, PANTHEIOS_BE_SPEECH_F_SYNCHRONOUS, &init->flags);
    }

    if(res >= 0)
    {
        // 2.b Parse the custom argument: "purgeBeforeSpeak"
        res = pantheios_be_parseBooleanArg(numArgs, args, PANTHEIOS_LITERAL_STRING("purgeBeforeSpeak"), true, PANTHEIOS_BE_SPEECH_F_PURGE_BEFORE_SPEAK, &init->flags);
    }

    if(res >= 0)
    {
        // 2.c Parse the custom argument: "speakPunctuation"
        res = pantheios_be_parseBooleanArg(numArgs, args, PANTHEIOS_LITERAL_STRING("speakPunctuation"), true, PANTHEIOS_BE_SPEECH_F_SPEAK_PUNCTUATION, &init->flags);
    }

    if(res >= 0)
    {
        // 2.d Parse the custom argument: "synchronousOnCritical"
        res = pantheios_be_parseBooleanArg(numArgs, args, PANTHEIOS_LITERAL_STRING("synchronousOnCritical"), true, PANTHEIOS_BE_SPEECH_F_SYNCHRONOUS_ON_CRITICAL, &init->flags);
    }

    return res;
}
开发者ID:dlex,项目名称:pantheios,代码行数:40,代码来源:bec.speech.cpp


示例7: main

int main()
{
  int i = pantheios_init();

  if(i >= 0)
  {
    /* 1. Using the Pantheios API macro PANTHEIOS_MAKE_EXTENDED_SEVERITY() */
    pantheios_logprintf(PANTHEIOS_MAKE_EXTENDED_SEVERITY(PANTHEIOS_SEV_NOTICE, 10), PANTHEIOS_LITERAL_STRING("hello"));


    /* 2 (a). In your code, you'd define your own, most succinct, symbol, e.g. ACME_XSEV(sev, xi28) */
#define ACME_XSEV(sev, xi28)    PANTHEIOS_MAKE_EXTENDED_SEVERITY(PANTHEIOS_SEV_ ## sev, xi28)

    /* 2 (b). and use it as follows */
    pantheios_logprintf(ACME_XSEV(NOTICE, 10), PANTHEIOS_LITERAL_STRING("hello"));


    pantheios_uninit();
  }

  return EXIT_SUCCESS;
}
开发者ID:dlex,项目名称:pantheios,代码行数:22,代码来源:example.c.extended_severity.c


示例8: main

int main()
{
  /* Must initialise Pantheios, when using from C (and there are no C++
   * compilation units in the link-unit).
   *
   * If this is not done, undefined behaviour will ensue ...
   */
  if(pantheios_init() < 0)
  {
    return EXIT_FAILURE;
  }
  else
  {
    pantheios_logputs(PANTHEIOS_SEV_DEBUG, PANTHEIOS_LITERAL_STRING("debug"));
    pantheios_logputs(PANTHEIOS_SEV_INFORMATIONAL, PANTHEIOS_LITERAL_STRING("info"));
    pantheios_logputs(PANTHEIOS_SEV_NOTICE, PANTHEIOS_LITERAL_STRING("notice"));
    pantheios_logputs(PANTHEIOS_SEV_WARNING, PANTHEIOS_LITERAL_STRING("warn"));

    pantheios_be_file_setFilePath(PANTHEIOS_LITERAL_STRING("file-1.log"), PANTHEIOS_BE_FILE_F_TRUNCATE, PANTHEIOS_BE_FILE_F_TRUNCATE, 1);

    pantheios_logputs(PANTHEIOS_SEV_ERROR, PANTHEIOS_LITERAL_STRING("error"));
    pantheios_logputs(PANTHEIOS_SEV_CRITICAL, PANTHEIOS_LITERAL_STRING("critical"));
    pantheios_logputs(PANTHEIOS_SEV_ALERT, PANTHEIOS_LITERAL_STRING("alert"));
    pantheios_logputs(PANTHEIOS_SEV_EMERGENCY, PANTHEIOS_LITERAL_STRING("emergency"));

    pantheios_be_file_setFilePath(PANTHEIOS_LITERAL_STRING("file-5.log"), 0, 0, 5);

    /* Must uninitialise Pantheios.
     *
     * pantheios_uninit() must be called once for each successful (>=0)
     * invocation of pantheios_init().
     */
    pantheios_uninit();

    return EXIT_SUCCESS;
  }
}
开发者ID:synesissoftware,项目名称:Pantheios,代码行数:37,代码来源:example.c.N.c


示例9: PANTHEIOS_CONTRACT_ENFORCE_PRECONDITION_PARAMS_INTERNAL

int be_fprintf_Context::rawLogEntry(
    int                 severity4
,   int                 /* severityX */
,   pan_char_t const*   entry
,   size_t              cchEntry
)
{
    PANTHEIOS_CONTRACT_ENFORCE_PRECONDITION_PARAMS_INTERNAL(severity4 >= 0, "severity must be >= 0");
    PANTHEIOS_CONTRACT_ENFORCE_PRECONDITION_PARAMS_INTERNAL(severity4 < 16, "severity must be < 16");

    // select the stream: stdout for debug/info/notice; stderr for everything else

    FILE* const stm = deduce_stm_(severity4);

    // output
    return pan_fprintf_(stm, PANTHEIOS_LITERAL_STRING("%.*s\n"), int(cchEntry), entry);
}
开发者ID:DoraXBMC,项目名称:Pantheios,代码行数:17,代码来源:bec.fprintf.cpp


示例10: PANTHEIOS_CALL

PANTHEIOS_CALL(PAN_CHAR_T const*) pantheios_fe_getProcessIdentity(void* token)
{
    STLSOFT_SUPPRESS_UNUSED(token);

    if(0 == s_feInitValue)
    {
        XTESTS_FAIL_WITH_QUALIFIER("front-end process identity interrogation", "front-end has not yet been initialised");
    }
    else if(1 != s_feInitValue)
    {
        XTESTS_FAIL_WITH_QUALIFIER("front-end process identity interrogation", "front-end has been uninitialised");
    }
    else if(0 != s_beInitValue)
    {
        XTESTS_FAIL_WITH_QUALIFIER("front-end process identity interrogation", "back-end has already been initialised");
    }

    return PANTHEIOS_LITERAL_STRING("test.component.core.initialisation_sequence");
}
开发者ID:synesissoftware,项目名称:Pantheios,代码行数:19,代码来源:test.component.core.initialisation_sequence.c


示例11: test_1_01

static void test_1_01();
static void test_1_02();
static void test_1_03();
static void test_1_04();
static void test_1_05();
static void test_1_06();
static void test_1_07();
static void test_1_08();
static void test_1_09();

/* /////////////////////////////////////////////////////////////////////////
 * Globals
 */

PANTHEIOS_EXTERN_C PAN_CHAR_T const PANTHEIOS_FE_PROCESS_IDENTITY[] = PANTHEIOS_LITERAL_STRING("test.component.custom_severity");

int main(int argc, char** argv)
{
    int retCode = EXIT_SUCCESS;
    int verbosity = 2;

    XTESTS_COMMANDLINE_PARSEVERBOSITY(argc, argv, &verbosity);

    if(XTESTS_START_RUNNER("test.component.custom_severity", verbosity))
    {
        XTESTS_RUN_CASE(test_1_01);
        XTESTS_RUN_CASE(test_1_02);
        XTESTS_RUN_CASE(test_1_03);
        XTESTS_RUN_CASE(test_1_04);
        XTESTS_RUN_CASE(test_1_05);
开发者ID:mvancompernolle,项目名称:ai_project,代码行数:30,代码来源:test.component.custom_severity.cpp


示例12: PANTHEIOS_CALL

PANTHEIOS_CALL(int) pantheios_be_WindowsSyslog_parseArgs(
    size_t                          numArgs
,   pan_slice_t* const              args
,   pan_be_WindowsSyslog_init_t*    init
)
{
    PANTHEIOS_CONTRACT_ENFORCE_PRECONDITION_PARAMS_API((NULL != args || 0 == numArgs), "argument pointer must be non-null, or number of arguments must be 0");
    PANTHEIOS_CONTRACT_ENFORCE_PRECONDITION_PARAMS_API(NULL != init, "initialisation structure pointer may not be null");

    pantheios_be_WindowsSyslog_getDefaultAppInit(init);

    // 1. Parse the stock arguments
    int res = pantheios_be_parseStockArgs(numArgs, args, &init->flags);

    if(res >= 0)
    {
        pan_slice_t address;
        pan_slice_t port;
        pan_slice_t facility;

        // 2.a Parse the custom argument: "address"
        res = pantheios_be_parseStringArg(numArgs, args, PANTHEIOS_LITERAL_STRING("address"), &address);

        if(res > 0)
        {
            if(address.len > sizeof(init->hostNameBuff) - 1)
            {
                res = PANTHEIOS_BE_INIT_RC_ARGUMENT_TOO_LONG;
            }
            else
            {
                ::memcpy(&init->hostNameBuff[0], address.ptr, sizeof(pan_char_t) * STLSOFT_NUM_ELEMENTS(init->hostNameBuff));
                init->hostNameBuff[address.len] = '\0';
                init->hostName = &init->hostNameBuff[0];
                init->addrSize = 0;
            }
        }

        if(res >= 0)
        {
            // 2.b Parse the custom argument: "port"
            res = pantheios_be_parseStringArg(numArgs, args, PANTHEIOS_LITERAL_STRING("port"), &port);

            if(res > 0)
            {
                char    sz[21];
                int     portNum;

                ::memcpy(&sz[0], port.ptr, stlsoft::minimum(port.len, sizeof(pan_char_t) * STLSOFT_NUM_ELEMENTS(sz) - 1));
                sz[stlsoft::minimum(port.len, STLSOFT_NUM_ELEMENTS(sz) - 1)] = '\0';

                portNum = ::atoi(sz);

                if( portNum > 0 &&
                    portNum < 65536)
                {
                    init->port = static_cast<pan_uint16_t>(portNum);
                }
                else
                {
                    res = PANTHEIOS_BE_INIT_RC_ARGUMENT_OUT_OF_RANGE;
                }
            }
        }

        if(res >= 0)
        {
            // 2.b Parse the custom argument: "facility"
            res = pantheios_be_parseStringArg(numArgs, args, PANTHEIOS_LITERAL_STRING("facility"), &facility);

            if(res > 0)
            {
                char    sz[21];
                int     facilityNum;

                ::memcpy(&sz[0], facility.ptr, stlsoft::minimum(facility.len, sizeof(pan_char_t) * STLSOFT_NUM_ELEMENTS(sz) - 1));
                sz[stlsoft::minimum(facility.len, STLSOFT_NUM_ELEMENTS(sz) - 1)] = '\0';

                facilityNum = ::atoi(sz);

                if( facilityNum >= 0 &&
                    facilityNum < 24)
                {
                    init->facility = static_cast<pan_uint8_t>(facilityNum);
                }
                else
                {
                    res = PANTHEIOS_BE_INIT_RC_ARGUMENT_OUT_OF_RANGE;
                }
            }
        }
    }

    if(res >= 0)
    {
        // 2.d Parse the custom argument: "useStderr"
        res = pantheios_be_parseBooleanArg(numArgs, args, PANTHEIOS_LITERAL_STRING("useStderr"), false, PANTHEIOS_BE_WINDOWSSYSLOG_F_PERROR, &init->flags);
    }

    if(res >= 0)
//.........这里部分代码省略.........
开发者ID:dlex,项目名称:pantheios,代码行数:101,代码来源:bec.WindowsSyslog.cpp


示例13: defined

#elif defined(PLATFORMSTL_OS_IS_WINDOWS)
# include <pantheios/backends/bec.WindowsSyslog.h>
#else /* ? OS */
# error Operating system not discriminated
#endif /* OS */

/* Standard C header files */
#include <stdlib.h>                                 /* for exit codes */

/* /////////////////////////////////////////////////////////////////////////
 * globals
 */

/* Define the stock front-end process identity, so that it links when using
 * fe.N, fe.simple, etc. */
const PAN_CHAR_T PANTHEIOS_FE_PROCESS_IDENTITY[]      =   PANTHEIOS_LITERAL_STRING("example.c.N");

pan_fe_N_t PAN_FE_N_SEVERITY_CEILINGS[]  =
{
    { 1,  PANTHEIOS_SEV_NOTICE    } /* Filters out everything below 'notice' */
  , { 2,  PANTHEIOS_SEV_DEBUG     } /* Allows all severities */
  , { 3,  PANTHEIOS_SEV_ERROR     } /* Allows only 'error', 'critical', 'alert', 'emergency' */
  , { 0,  PANTHEIOS_SEV_NOTICE    } /* Terminates the array; sets the default ceiling to 'notice' */
};

pan_be_N_t PAN_BE_N_BACKEND_LIST[] =
{
    PANTHEIOS_BE_N_STDFORM_ENTRY(1, pantheios_be_file, 0)
  , PANTHEIOS_BE_N_STDFORM_ENTRY(2, pantheios_be_fprintf, 0)
  , PANTHEIOS_BE_N_STDFORM_ENTRY(3, pantheios_be_null, 0)
#if defined(PLATFORMSTL_OS_IS_UNIX)
开发者ID:synesissoftware,项目名称:Pantheios,代码行数:31,代码来源:example.c.N.c


示例14: PANTHEIOS_SEV_LEVELS_EQUAL

/* Standard C Header Files */
#include <stdlib.h>                     // for exit codes

#include <pantheios/util/test/compiler_warnings_suppression.last_include.h>

/* /////////////////////////////////////////////////////////////////////////
 * Macros
 */

#define PANTHEIOS_SEV_LEVELS_EQUAL(x, y)    XTESTS_TEST_INTEGER_EQUAL(static_cast<int>(x), static_cast<int>(y))

/* /////////////////////////////////////////////////////////////////////////
 * Globals
 */

PANTHEIOS_EXTERN_C PAN_CHAR_T const PANTHEIOS_FE_PROCESS_IDENTITY[] = PANTHEIOS_LITERAL_STRING("test.unit.levels.dynamic_initialisation");

/* ////////////////////////////////////////////////////////////////////// */

const int   debug           =   ::pantheios::debug;
const int   informational   =   ::pantheios::informational;
const int   notice          =   ::pantheios::notice;
const int   warning         =   ::pantheios::warning;
const int   error           =   ::pantheios::error;
const int   critical        =   ::pantheios::critical;
const int   alert           =   ::pantheios::alert;
const int   emergency       =   ::pantheios::emergency;

DynamicInit::DynamicInit()
    : debug         (::pantheios::debug)
    , informational (::pantheios::informational)
开发者ID:dlex,项目名称:pantheios,代码行数:31,代码来源:test.unit.levels.dynamic_initialisation.cpp


示例15: PANTHEIOS_TEST_TIME

 * typedefs
 */

typedef std::basic_string<PAN_CHAR_T>   string_t;

/* /////////////////////////////////////////////////////////////////////////
 * macros
 */

#define PANTHEIOS_TEST_TIME(buffSize, flags, result, pattern)   test_time(__FILE__, __LINE__, buffSize, flags, result, pattern)

/* /////////////////////////////////////////////////////////////////////////
 * globals
 */

PANTHEIOS_EXTERN_C const PAN_CHAR_T PANTHEIOS_FE_PROCESS_IDENTITY[] = PANTHEIOS_LITERAL_STRING("test.unit.util.getcurrenttime");

/* /////////////////////////////////////////////////////////////////////////
 * forward declarations
 */

static int      test_time(char const* file, int line, size_t cchBuff, int flags, size_t expectedResult, PAN_CHAR_T const* pattern);
static string_t translate_pattern(PAN_CHAR_T const* pattern);

static void     test_unix_0();
static void     test_unix_F_USE_SYSTEM_TIME();
static void     test_unix_F_HIDE_DATE();
static void     test_unix_F_HIDE_TIME();
#if defined(PLATFORMSTL_OS_IS_WINDOWS)
static void     test_win_0();
static void     test_win_F_USE_SYSTEM_TIME();
开发者ID:synesissoftware,项目名称:Pantheios,代码行数:31,代码来源:test.unit.util.getcurrenttime.cpp


示例16: test_1_01

#include <pantheios/util/test/compiler_warnings_suppression.last_include.h>

/* /////////////////////////////////////////////////////////////////////////
 * Forward declarations
 */

static void test_1_01();

static int pan_get_pid_();

/* ////////////////////////////////////////////////////////////////////// */

/* Define the stock front-end process identity, so that it links when using
 * fe.N, fe.simple, etc. */
PANTHEIOS_EXTERN_C const PAN_CHAR_T PANTHEIOS_FE_PROCESS_IDENTITY[] = PANTHEIOS_LITERAL_STRING("test.component.inserters.processId");

/* ////////////////////////////////////////////////////////////////////// */

#define PSTR(x)         PANTHEIOS_LITERAL_STRING(x)

/* /////////////////////////////////////////////////////////////////////////
 * Character encoding
 */

#ifdef PANTHEIOS_USE_WIDE_STRINGS

# define XTESTS_TEST_STRING_EQUAL       XTESTS_TEST_WIDE_STRING_EQUAL

#else /* ? PANTHEIOS_USE_WIDE_STRINGS */
开发者ID:DoraXBMC,项目名称:Pantheios,代码行数:29,代码来源:test.component.inserters.processId.cpp


示例17: PSTR

#endif /* _MSC_VER) && _DEBUG */

#include <pantheios/util/test/compiler_warnings_suppression.last_include.h>

/* ////////////////////////////////////////////////////////////////////// */

#define PSTR(x)         PANTHEIOS_LITERAL_STRING(x)

/* /////////////////////////////////////////////////////////////////////////
 * Globals
 */

extern "C"
{

const PAN_CHAR_T PANTHEIOS_FE_PROCESS_IDENTITY[]      =   PANTHEIOS_LITERAL_STRING("be.N.fail.test");
pan_fe_N_t PAN_FE_N_SEVERITY_CEILINGS[]   =
{
    {   0,  PANTHEIOS_SEV_DEBUG  }
};
pan_be_N_t      PAN_BE_N_BACKEND_LIST[]         =
{
    PANTHEIOS_BE_N_STDFORM_ENTRY(1, pantheios_be_fail, PANTHEIOS_BE_N_F_IGNORE_INIT_FAILURE),
    PANTHEIOS_BE_N_STDFORM_ENTRY(2, pantheios_be_file, 0),
    PANTHEIOS_BE_N_STDFORM_ENTRY(3, pantheios_be_fail, PANTHEIOS_BE_N_F_IGNORE_INIT_FAILURE),
    PANTHEIOS_BE_N_STDFORM_ENTRY(4, pantheios_be_fprintf, 0),
    PANTHEIOS_BE_N_TERMINATOR_ENTRY
};

} // extern "C"
开发者ID:DoraXBMC,项目名称:Pantheios,代码行数:30,代码来源:test.scratch.be.N.fail.cpp


示例18: PANTHEIOS_LITERAL_STRING

/* Pantheios header files */
#define PANTHEIOS_NO_INCLUDE_OS_AND_3PTYLIB_STRING_ACCESS // Faster compilation
#include <pantheios/pantheios.hpp>          // Pantheios C++ main header

/* Standard C/C++ header files */
#include <exception>                        // for std::exception
#include <new>                              // for std::bad_alloc
#include <string>                           // for std::string
#include <stdlib.h>                         // for exit codes

/* ////////////////////////////////////////////////////////////////////// */

/* Define the stock front-end process identity, so that it links when using
 * fe.N, fe.simple, etc. */
PANTHEIOS_EXTERN_C const PAN_CHAR_T PANTHEIOS_FE_PROCESS_IDENTITY[] = PANTHEIOS_LITERAL_STRING("example.cpp.misc.strings");

/* ////////////////////////////////////////////////////////////////////// */

#define PSTR(x)         PANTHEIOS_LITERAL_STRING(x)

/* ////////////////////////////////////////////////////////////////////// */

typedef std::basic_string<PAN_CHAR_T>   string_t;

/* ////////////////////////////////////////////////////////////////////// */

static string_t concat(string_t const& s1, string_t const& s2)
{
    return s1 + s2;
}
开发者ID:DoraXBMC,项目名称:Pantheios,代码行数:30,代码来源:example.cpp.misc.strings.cpp


示例19: PANTHEIOS_CONTRACT_ENFORCE_PRECONDITION_PARAMS_API

void pointer::construct_()
{
    PANTHEIOS_CONTRACT_ENFORCE_PRECONDITION_PARAMS_API(0 == m_sz[0], "cannot construct if value is non-empty");
    PANTHEIOS_CONTRACT_ENFORCE_PRECONDITION_PARAMS_API(0 == m_len, "cannot construct if length is non-0");

    if(static_cast<void const*>(0) == m_value)
    {
        static const pan_char_t  s_null[] = PANTHEIOS_LITERAL_STRING("(null)");

        STLSOFT_STATIC_ASSERT(sizeof(m_sz) >= sizeof(s_null));

        ::memcpy(&m_sz[0], &s_null[0], sizeof(s_null));

        m_len = STLSOFT_NUM_ELEMENTS(s_null) - 1;
    }
    else
    {
        pan_char_t          szFmt[101];
        int                 width;
        pan_char_t const*   zeroX;
        pan_char_t const*   leadingMinus;
        pan_char_t const*   zeroPad;

        if(m_minWidth < 0)
        {
            width           =   -m_minWidth;
            leadingMinus    =   PANTHEIOS_LITERAL_STRING("-");
        }
        else
        {
            width           =   m_minWidth;
            leadingMinus    =   PANTHEIOS_LITERAL_STRING("");
        }

        zeroX   =   (m_format & fmt::zeroXPrefix) ? PANTHEIOS_LITERAL_STRING("0x") : PANTHEIOS_LITERAL_STRING("");
        zeroPad =   (m_format & fmt::zeroPad) ? PANTHEIOS_LITERAL_STRING("0") : PANTHEIOS_LITERAL_STRING("");

        if( 0 != width &&
            fmt::zeroXPrefix == (m_format & (fmt::zeroXPrefix | fmt::zeroPad)))
        {
            // Special case

            pan_char_t szTemp[23]; // 23 is always big enough, since the width is 21

            PANTHEIOS_CONTRACT_ENFORCE_ASSUMPTION(0 == (m_format & fmt::zeroPad));

            // Determine ptr-sized integer type
#if defined(STLSOFT_COMPILER_IS_GCC)
            typedef unsigned long                                             intptr_t_;
#else /* ? compiler */
            typedef stlsoft::int_size_traits<sizeof(void*)>::unsigned_type    intptr_t_;
#endif /* compiler */

            int r = pantheios_util_snprintf(
                        &szTemp[0]
                    ,   STLSOFT_NUM_ELEMENTS(szTemp)
                    ,   PANTHEIOS_LITERAL_STRING("0x%lx")
                    ,   static_cast<intptr_t_>(stlsoft::union_cast<intptr_t_>(m_value))
                    );

            if(r < 0)
            {
                return;
            }
            else
            {
                size_t n = static_cast<size_t>(r);

                PANTHEIOS_CONTRACT_ENFORCE_POSTCONDITION_RETURN_INTERNAL((n + 2) <= STLSOFT_NUM_ELEMENTS(szTemp), "snprintf() overwrote the local buffer capacity");

                width += 2;

                if(static_cast<size_t>(width) > n)
                {
                    if(m_minWidth < 0)
                    {
                        PANTHEIOS_char_copy(&m_sz[0], szTemp, n);
                        std::fill_n(&m_sz[0] + n, size_t(width - n), ' ');
                        m_sz[width] = '\0';
                    }
                    else
                    {
                        std::fill_n(&m_sz[0], size_t(width - n), ' ');
                        PANTHEIOS_char_copy(&m_sz[0] + (size_t(width) - n), szTemp, (n + 1));
                    }

                    m_len = static_cast<size_t>(width);
                }
                else
                {
                    PANTHEIOS_char_copy(&m_sz[0], szTemp, (n + 1));

                    m_len = n;
                }
            }
        }
        else
        {
            pantheios_util_snprintf(&szFmt[0]
                                ,   STLSOFT_NUM_ELEMENTS(szFmt)
//.........这里部分代码省略.........
开发者ID:synesissoftware,项目名称:Pantheios,代码行数:101,代码来源:pointer.cpp


示例20: defined

#include <exception>                            // for std::exception
#include <new>                                  // for std::bad_alloc
#include <string>                               // for std::string
#include <stdlib.h>                             // for exit codes

#ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
# if defined(STLSOFT_COMPILER_IS_MSVC)
#  pragma warning(disable : 4702)
# endif /* compiler */
#endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */

/* ////////////////////////////////////////////////////////////////////// */

/* Define the stock front-end process identity, so that it links when using
 * fe.N, fe.simple, etc. */
PANTHEIOS_EXTERN_C const PAN_CHAR_T PANTHEIOS_FE_PROCESS_IDENTITY[] = PANTHEIOS_LITERAL_STRING("example.cpp.inserter.threadid");

/* ////////////////////////////////////////////////////////////////////// */

#define PSTR(x)         PANTHEIOS_LITERAL_STRING(x)

/* ////////////////////////////////////////////////////////////////////// */

int main()
{
  try
  {
    // Log the thread Id; Output: "thread id: [3540]"

    pantheios::log_NOTICE(PSTR("thread id: ["), pantheios::threadId, PSTR("]"));
开发者ID:DoraXBMC,项目名称:Pantheios,代码行数:30,代码来源:example.cpp.inserter.threadid.cpp



注:本文中的PANTHEIOS_LITERAL_STRING函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PAPIERROR函数代码示例发布时间:2022-05-30
下一篇:
C++ PANIC函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap