Add low- and uppercase for std::string.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3078
This commit is contained in:
parent
50917251f4
commit
bd88bcea69
2 changed files with 22 additions and 5 deletions
|
@ -16,10 +16,13 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: support.h,v 1.16 2008-01-13 11:28:41 qbix79 Exp $ */
|
||||
|
||||
#ifndef DOSBOX_SUPPORT_H
|
||||
#define DOSBOX_SUPPORT_H
|
||||
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <ctype.h>
|
||||
#ifndef DOSBOX_DOSBOX_H
|
||||
#include "dosbox.h"
|
||||
|
@ -28,10 +31,6 @@
|
|||
#if defined (_MSC_VER) /* MS Visual C++ */
|
||||
#define strcasecmp(a,b) stricmp(a,b)
|
||||
#define strncasecmp(a,b,n) _strnicmp(a,b,n)
|
||||
// if (stricmp(name,devices[index]->name)==0) return index;
|
||||
#else
|
||||
//if (strcasecmp(name,devices[index]->name)==0) return index;
|
||||
//#define nocasestrcmp(a,b) stricmp(a,b)
|
||||
#endif
|
||||
|
||||
#define safe_strncpy(a,b,n) do { strncpy((a),(b),(n)-1); (a)[(n)-1] = 0; } while (0)
|
||||
|
@ -63,5 +62,7 @@ INLINE char * lowcase(char * str) {
|
|||
return str;
|
||||
}
|
||||
|
||||
void upcase(std::string &str);
|
||||
void lowcase(std::string &str);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: support.cpp,v 1.33 2007-10-31 11:45:14 qbix79 Exp $ */
|
||||
/* $Id: support.cpp,v 1.34 2008-01-13 11:28:41 qbix79 Exp $ */
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -25,11 +25,27 @@
|
|||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <string>
|
||||
|
||||
#include "dosbox.h"
|
||||
#include "debug.h"
|
||||
#include "support.h"
|
||||
#include "video.h"
|
||||
|
||||
|
||||
void upcase(std::string &str) {
|
||||
int (*tf)(int) = std::toupper;
|
||||
std::transform(str.begin(), str.end(), str.begin(), tf);
|
||||
}
|
||||
|
||||
void lowcase(std::string &str) {
|
||||
int (*tf)(int) = std::tolower;
|
||||
std::transform(str.begin(), str.end(), str.begin(), tf);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Ripped some source from freedos for this one.
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue