source: vendor/synergy/current/lib/base/XBase.cpp

Last change on this file was 2749, checked in by bird, 19 years ago

synergy v1.3.1 sources (zip).

File size: 1.2 KB
Line 
1/*
2 * synergy -- mouse and keyboard sharing utility
3 * Copyright (C) 2002 Chris Schoeneman
4 *
5 * This package is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * found in the file COPYING that should have accompanied this file.
8 *
9 * This package is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#include "XBase.h"
16#include "CStringUtil.h"
17#include <cerrno>
18#include <cstdarg>
19
20//
21// XBase
22//
23
24XBase::XBase() :
25 m_what()
26{
27 // do nothing
28}
29
30XBase::XBase(const CString& msg) :
31 m_what(msg)
32{
33 // do nothing
34}
35
36XBase::~XBase()
37{
38 // do nothing
39}
40
41const char*
42XBase::what() const
43{
44 if (m_what.empty()) {
45 m_what = getWhat();
46 }
47 return m_what.c_str();
48}
49
50CString
51XBase::format(const char* /*id*/, const char* fmt, ...) const throw()
52{
53 // FIXME -- lookup message string using id as an index. set
54 // fmt to that string if it exists.
55
56 // format
57 CString result;
58 va_list args;
59 va_start(args, fmt);
60 try {
61 result = CStringUtil::vformat(fmt, args);
62 }
63 catch (...) {
64 // ignore
65 }
66 va_end(args);
67
68 return result;
69}
Note: See TracBrowser for help on using the repository browser.