[sword-cvs] sword/include stringmgr.h,NONE,1.1 Makefile.am,1.29,1.30 utilstr.h,1.11,1.12

sword@www.crosswire.org sword@www.crosswire.org
Sat, 17 Apr 2004 10:16:19 -0700


Update of /cvs/core/sword/include
In directory www:/tmp/cvs-serv8616/include

Modified Files:
	Makefile.am utilstr.h 
Added Files:
	stringmgr.h 
Log Message:
Added StringMgr to allow frontend side unicode handling; breaks no code; IcuStringMgr needs a fix in upperUtf8; added support for loading Utf8 locales (joachim)

--- NEW FILE: stringmgr.h ---
/******************************************************************************
 *	stringmgr.h - A class which provides string andling functions which can 
 			reimplemented by frontends
 *
 * $Id: stringmgr.h,v 1.1 2004/04/17 17:16:16 joachim Exp $
 *
 * Copyright 1998 CrossWire Bible Society (http://www.crosswire.org)
 *	CrossWire Bible Society
 *	P. O. Box 2528
 *	Tempe, AZ	85280-2528
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation version 2.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the GNU
 * General Public License for more details.
 *
 */


#ifndef STRINGMGR_H
#define STRINGMGR_H

#include <swbuf.h>

SWORD_NAMESPACE_START

class StringMgr {
public:
	/** Sets the global StringMgr handle
	* @param newStringMgr The new global StringMgr. This pointer will be deleted by this StringMgr
	*/	
	static void setSystemStringMgr( StringMgr* newStringMgr );
	/** Returns the global StringMgr handle
	* @return The global string handle
	*/
	static StringMgr* getSystemStringMgr();
	/*
	*/
	static const bool hasUtf8Support() {
		return getSystemStringMgr()->supportsUnicode();
	};
	
	/** Converts the param to an upper case Utf8 string
	* @param The text encoded in utf8 which should be turned into an upper case string
	*/	
	virtual char* upperUtf8(char*, const unsigned int max = 0);
	/** Converts the param to an uppercase latin1 string
	* @param The text encoded in latin1 which should be turned into an upper case string
	*/	
	virtual char* upperLatin1(char*);
	

protected:
	friend class __staticsystemStringMgr;
	
	/** Default constructor
	*/		
	StringMgr();
	/** Copy constructor
	*/	
	StringMgr( const StringMgr& );
	/** Destructor
	*/	
	virtual ~StringMgr();
	
	virtual const bool supportsUnicode() const;

private:
	static StringMgr* m_systemStringMgr;
};

namespace utilstr {
	inline char* toupperstr( char* t ) {
		return StringMgr::getSystemStringMgr()->upperLatin1( t );
	};
	
	inline char* toupperstr_utf8( char* t, const unsigned int max = 0 ) {
		return StringMgr::getSystemStringMgr()->upperUtf8( t, max );
	};
};
using namespace utilstr;

SWORD_NAMESPACE_END


#endif //STRINGMGR_H

Index: Makefile.am
===================================================================
RCS file: /cvs/core/sword/include/Makefile.am,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- Makefile.am	14 Mar 2004 03:39:54 -0000	1.29
+++ Makefile.am	17 Apr 2004 17:16:16 -0000	1.30
@@ -89,6 +89,7 @@
 pkginclude_HEADERS += $(swincludedir)/swlog.h
 pkginclude_HEADERS += $(swincludedir)/swmacs.h
 pkginclude_HEADERS += $(swincludedir)/swmgr.h
+pkginclude_HEADERS += $(swincludedir)/stringmgr.h
 pkginclude_HEADERS += $(swincludedir)/swmodule.h
 pkginclude_HEADERS += $(swincludedir)/swoptfilter.h
 pkginclude_HEADERS += $(swincludedir)/swobject.h

Index: utilstr.h
===================================================================
RCS file: /cvs/core/sword/include/utilstr.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- utilstr.h	22 Jun 2003 23:50:23 -0000	1.11
+++ utilstr.h	17 Apr 2004 17:16:16 -0000	1.12
@@ -22,6 +22,8 @@
 #ifndef UTILSTR_H
 #define UTILSTR_H
 
+#include <swbuf.h>
+#include <stringmgr.h>
 #include <defs.h>
 
 SWORD_NAMESPACE_START
@@ -33,8 +35,8 @@
 const char *stristr (const char *s1, const char *s2);
 const char strnicmp(const char *s1, const char *s2, int len);
 unsigned int strlenw(const char *s1);
-char *toupperstr(char *buf);
-char *toupperstr_utf8(char *buf, unsigned int max = 0);
+// char *toupperstr(char *buf);
+// char *toupperstr_utf8(char *buf, unsigned int max = 0);
 
 /*
 extern "C" {