| 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 |  | 
|---|
| 24 | XBase::XBase() : | 
|---|
| 25 | m_what() | 
|---|
| 26 | { | 
|---|
| 27 | // do nothing | 
|---|
| 28 | } | 
|---|
| 29 |  | 
|---|
| 30 | XBase::XBase(const CString& msg) : | 
|---|
| 31 | m_what(msg) | 
|---|
| 32 | { | 
|---|
| 33 | // do nothing | 
|---|
| 34 | } | 
|---|
| 35 |  | 
|---|
| 36 | XBase::~XBase() | 
|---|
| 37 | { | 
|---|
| 38 | // do nothing | 
|---|
| 39 | } | 
|---|
| 40 |  | 
|---|
| 41 | const char* | 
|---|
| 42 | XBase::what() const | 
|---|
| 43 | { | 
|---|
| 44 | if (m_what.empty()) { | 
|---|
| 45 | m_what = getWhat(); | 
|---|
| 46 | } | 
|---|
| 47 | return m_what.c_str(); | 
|---|
| 48 | } | 
|---|
| 49 |  | 
|---|
| 50 | CString | 
|---|
| 51 | XBase::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.