• Main Page
  • Classes
  • Files
  • File List

XBase.cpp

00001 /*
00002  * synergy -- mouse and keyboard sharing utility
00003  * Copyright (C) 2012 Bolton Software Ltd.
00004  * Copyright (C) 2002 Chris Schoeneman
00005  * 
00006  * This package is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * found in the file COPYING that should have accompanied this file.
00009  * 
00010  * This package is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017  */
00018 
00019 #include "XBase.h"
00020 #include "CStringUtil.h"
00021 #include <cerrno>
00022 #include <cstdarg>
00023 
00024 //
00025 // XBase
00026 //
00027 
00028 XBase::XBase() :
00029     m_what()
00030 {
00031     // do nothing
00032 }
00033 
00034 XBase::XBase(const CString& msg) :
00035     m_what(msg)
00036 {
00037     // do nothing
00038 }
00039 
00040 XBase::~XBase()
00041 {
00042     // do nothing
00043 }
00044 
00045 const char*
00046 XBase::what() const
00047 {
00048     if (m_what.empty()) {
00049         m_what = getWhat();
00050     }
00051     return m_what.c_str();
00052 }
00053 
00054 CString
00055 XBase::format(const char* /*id*/, const char* fmt, ...) const throw()
00056 {
00057     // FIXME -- lookup message string using id as an index.  set
00058     // fmt to that string if it exists.
00059 
00060     // format
00061     CString result;
00062     va_list args;
00063     va_start(args, fmt);
00064     try {
00065         result = CStringUtil::vformat(fmt, args);
00066     }
00067     catch (...) {
00068         // ignore
00069     }
00070     va_end(args);
00071 
00072     return result;
00073 }

Generated on Sat May 25 2013 00:00:04 for Synergy by  doxygen 1.7.1