source/ui/unoglobal.cxx

Go to the documentation of this file.
00001 /*************************************************************************
00002  *
00003  *  The Contents of this file are made available subject to
00004  *  the terms of GNU Lesser General Public License Version 2.1.
00005  *
00006  *
00007  *    GNU Lesser General Public License Version 2.1
00008  *    =============================================
00009  *    Copyright 2005 by Kohei Yoshida.
00010  *    1039 Kingsway Dr., Apex, NC 27502, USA
00011  *
00012  *    This library is free software; you can redistribute it and/or
00013  *    modify it under the terms of the GNU Lesser General Public
00014  *    License version 2.1, as published by the Free Software Foundation.
00015  *
00016  *    This library is distributed in the hope that it will be useful,
00017  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019  *    Lesser General Public License for more details.
00020  *
00021  *    You should have received a copy of the GNU Lesser General Public
00022  *    License along with this library; if not, write to the Free Software
00023  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00024  *    MA  02111-1307  USA
00025  *
00026  ************************************************************************/
00027  
00028 #include <unoglobal.hxx>
00029 #include <iostream>
00030 #include <com/sun/star/lang/XServiceInfo.hpp>
00031 #include <com/sun/star/table/CellAddress.hpp>
00032 
00033 using ::com::sun::star::uno::Any;
00034 
00035 namespace scsolver {
00036 
00037 void printOUStr( const rtl::OUString & ou )
00038 {
00039     rtl::OString o = OUStringToOString( ou, RTL_TEXTENCODING_UTF8 );
00040     std::cout << o.getStr() << std::endl;
00041 }
00042 
00043 const ::rtl::OUString ascii(const sal_Char* text)
00044 {
00045         return rtl::OUString::createFromAscii(text);
00046 }
00047 
00048 const Any asciiAny(const sal_Char* text)
00049 {
00050     Any any;
00051     any <<= ascii(text);
00052     return any;
00053 }
00054 
00062 void split( const rtl::OUString& sStr, const rtl::OUString& sSep,
00063                 std::vector<rtl::OUString>& cn )
00064 {
00065         sal_Int32 nLenSep = sSep.getLength();
00066         sal_Int32 nPos = sStr.indexOf( sSep );
00067         sal_Int32 nStart = 0;
00068         
00069         while ( nPos > -1 )
00070         {
00071                 rtl::OUString s = sStr.copy( nStart, nPos - nStart );
00072                 nStart = nPos + nLenSep;
00073                 nPos = sStr.indexOf( sSep, nStart );
00074                 cn.push_back( s );
00075         }
00076         rtl::OUString s = sStr.copy( nStart );
00077         cn.push_back( s );
00078 }
00079 
00080 
00081 // Global Parameters
00082 
00083 const rtl::OUString Global::STRING_SEPARATOR = ascii( "," );
00084 const rtl::OUString Global::MODEL_METADATA_NAME = ascii( "us.kohei.ooo.solver:model" );
00085 
00086 RuntimeError::RuntimeError( const rtl::OUString& umsg ) :
00087         m_sUniMsg( umsg )
00088 {
00089 }
00090 
00091 RuntimeError::~RuntimeError() throw()
00092 {
00093 }
00094 
00095 const char* RuntimeError::what() const throw()
00096 {
00097         rtl::OString o = OUStringToOString(m_sUniMsg, RTL_TEXTENCODING_UTF8);
00098     return o.getStr();
00099 }
00100 
00101 const rtl::OUString RuntimeError::getMessage() const throw()
00102 {
00103         return m_sUniMsg;
00104 }
00105 
00106 
00107 }
00108 
00109 
00110 

Generated on Mon Jul 28 09:13:20 2008 for scsolver by  doxygen 1.5.3