本文整理汇总了C++中SDL_GetClipboardText函数的典型用法代码示例。如果您正苦于以下问题:C++ SDL_GetClipboardText函数的具体用法?C++ SDL_GetClipboardText怎么用?C++ SDL_GetClipboardText使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SDL_GetClipboardText函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SDL_GetClipboardText
/*
================
Sys_GetClipboardData
create buffer, that contain clipboard
================
*/
char *Sys_GetClipboardData( void )
{
#ifdef XASH_SDL
return SDL_GetClipboardText();
#else
return 0;
#endif
}
示例2: console_paste
void console_paste()
{
char *p = SDL_GetClipboardText();
char *q = p;
while( p && *p )
console_put(*p++);
SDL_free(q);
}
示例3: text
virtual std::string text() const
{
char* clipboardText = SDL_GetClipboardText();
if (clipboardText == NULL)
return std::string{};
else
return std::string{clipboardText};
}
示例4: SDL_free
const char* CInput::GetClipboardText()
{
if(m_pClipboardText)
{
SDL_free(m_pClipboardText);
}
m_pClipboardText = SDL_GetClipboardText();
return m_pClipboardText;
}
示例5: PDC_getclipboard
int PDC_getclipboard(char **contents, long *length)
{
PDC_LOG(("PDC_getclipboard() - called\n"));
if (SDL_HasClipboardText() == SDL_FALSE)
return PDC_CLIP_EMPTY;
*contents = SDL_GetClipboardText();
*length = strlen(*contents);
return PDC_CLIP_SUCCESS;
}
示例6: SDL_GetClipboardText
char *Runtime::getClipboardText() {
char *result;
char *text = SDL_GetClipboardText();
if (text && text[0]) {
result = strdup(text);
SDL_free(text);
} else {
result = NULL;
}
return result;
}
示例7: clipboard_testGetClipboardText
/**
* \brief Check call to SDL_GetClipboardText
*
* \sa
* http://wiki.libsdl.org/moin.cgi/SDL_GetClipboardText
*/
int
clipboard_testGetClipboardText(void *arg)
{
char *charResult;
charResult = SDL_GetClipboardText();
SDLTest_AssertPass("Call to SDL_GetClipboardText succeeded");
if (charResult) SDL_free(charResult);
return TEST_COMPLETED;
}
示例8: copy_from_clipboard
std::string copy_from_clipboard(const bool)
{
char* clipboard = SDL_GetClipboardText();
if(!clipboard) {
return std::string();
}
const std::string result(clipboard);
SDL_free(clipboard);
return result;
}
示例9: SDL_free
const char *CInput::GetClipboardText()
{
if(m_pClipboardText)
{
SDL_free(m_pClipboardText);
}
m_pClipboardText = SDL_GetClipboardText();
if(m_pClipboardText)
str_sanitize_cc(m_pClipboardText);
return m_pClipboardText;
}
示例10: SDL_GetClipboardText
Platform::ClipboardData Platform::get_clipboard_data() {
if (!SDL_HasClipboardText())
return ClipboardData{};
auto text = SDL_GetClipboardText();
if (!text)
return ClipboardData{};
auto data = ClipboardData{text};
SDL_free(text);
return data;
}
示例11: SDL_GetClipboardText
wchar *Sys_GetClipboardTextW(void)
{
char *tmp;
wchar *wtmp = NULL;
if (SDL_HasClipboardText()) {
tmp = SDL_GetClipboardText();
wtmp = str2wcs(tmp);
free(tmp);
}
return wtmp;
}
示例12: SDL_GetClipboardText
std::string WindowSDL::getClipboardText() const {
if(SDL_HasClipboardText() == SDL_FALSE) {
return std::string();
}
auto sdlText = SDL_GetClipboardText();
if(sdlText == nullptr) {
WARN(std::string("SDL_GetClipboardText failed: ") + SDL_GetError());
return std::string();
}
const std::string text(sdlText);
SDL_free(sdlText);
return text;
}
示例13: SDL_GetClipboardText
/*
==================
Sys_GetClipboardData
==================
*/
char *Sys_GetClipboardData(void) {
if ( !SDL_HasClipboardText() )
return NULL;
char *cbText = SDL_GetClipboardText();
size_t len = strlen( cbText ) + 1;
char *buf = (char *)Z_Malloc( len, TAG_CLIPBOARD, qfalse );
Q_strncpyz( buf, cbText, len );
SDL_free( cbText );
return buf;
}
示例14: text
std::string System::getClipboardText() const
{
std::string text("");
char *ctext = SDL_GetClipboardText();
if (ctext)
{
text = std::string(ctext);
SDL_free(ctext);
}
return text;
}
示例15: system_getClipboardText
const char* system_getClipboardText()
{
char* text = SDL_GetClipboardText(); //it's not null terminated
if (text)
{
moduleData.clipboardText = malloc(strlen(text) + 1);
strcpy(moduleData.clipboardText, text);
SDL_free(text);
return moduleData.clipboardText;
}
return "";
}