CloverBootloader/rEFIt_UEFI/cpp_foundation/XString.cpp

61 lines
1.0 KiB
C++
Raw Normal View History

/*
*
* Created by jief in 1997.
* Copyright (c) 2020 Jief
* All rights reserved.
*
*/
2020-03-12 15:40:38 +01:00
#if 0
2020-04-24 11:30:09 +02:00
#define DBG(...) printf__VA_ARGS__)
2020-03-12 15:40:38 +01:00
#else
#define DBG(...)
#endif
2020-08-17 21:40:52 +02:00
#include <Platform.h> // Only use angled for Platform, else, xcode project won't compile
2020-03-12 15:40:38 +01:00
#include "XString.h"
#include "../../Include/Library/printf_lite.h"
2020-03-12 15:40:38 +01:00
const XString8 NullXString8;
const XString16 NullXString16;
const XString32 NullXString32;
2020-04-23 15:20:48 +02:00
const XStringW NullXStringW;
2020-03-12 15:40:38 +01:00
XString8 S8Printf(const char* format, ...)
2020-03-12 15:40:38 +01:00
{
XTOOLS_VA_LIST va;
2020-04-30 08:03:56 +02:00
XString8 str;
2020-03-12 15:40:38 +01:00
XTOOLS_VA_START (va, format);
str.vS8Printf(format, va);
XTOOLS_VA_END(va);
2020-03-12 15:40:38 +01:00
2020-04-23 15:20:48 +02:00
return str;
2020-03-12 15:40:38 +01:00
}
2020-04-23 15:20:48 +02:00
XStringW SWPrintf(const char* format, ...)
2020-03-12 15:40:38 +01:00
{
XTOOLS_VA_LIST va;
2020-04-23 15:20:48 +02:00
XStringW str;
2020-03-12 15:40:38 +01:00
XTOOLS_VA_START (va, format);
2020-04-23 15:20:48 +02:00
str.vSWPrintf(format, va);
XTOOLS_VA_END(va);
2020-03-12 15:40:38 +01:00
2020-04-23 15:20:48 +02:00
return str;
2020-03-12 15:40:38 +01:00
}
2020-04-23 15:20:48 +02:00
//XStringW SubString(const wchar_t *S, UINTN pos, UINTN count)
2020-03-12 15:40:38 +01:00
//{
2020-04-23 15:20:48 +02:00
// if ( wcslen(S)-pos < count ) count = wcslen(S)-pos;
// XStringW ret;
// ret.StrnCpy(S+pos, count);
//// return ( XStringW(S+pos, count) );
// return ret;
2020-03-12 15:40:38 +01:00
//}
//