first check-in of feisty meow codebase. many things broken still due to recent
[feisty_meow.git] / core / library / basis / guards.cpp
1 //////////////
2 // Name   : guards
3 // Author : Chris Koeritz
4 //////////////
5 // Copyright (c) 1989-$now By Author.  This program is free software; you can
6 // redistribute it and/or modify it under the terms of the GNU General Public
7 // License as published by the Free Software Foundation:
8 //     http://www.gnu.org/licenses/gpl.html
9 // or under the terms of the GNU Library license:
10 //     http://www.gnu.org/licenses/lgpl.html
11 // at your preference.  Those licenses describe your legal rights to this
12 // software, and no other rights or warranties apply.
13 // Please send updates for this code to: fred@gruntose.com -- Thanks, fred.
14 //////////////
15
16 #include "astring.h"
17 #include "guards.h"
18
19 namespace basis {
20
21 void format_error(const base_string &class_name, const base_string &func_name,
22     const base_string &error_message, base_string &to_fill)
23 {
24   astring to_return = class_name;
25   to_return += "::";
26   to_return += func_name;
27   to_return += ": ";
28   to_return += error_message;
29   to_fill = to_return;
30 }
31
32 void throw_error(const base_string &class_name, const base_string &func_name,
33     const base_string &error_message)
34 {
35   astring to_throw;
36   format_error(class_name, func_name, error_message, to_throw);
37   throw to_throw;
38 }
39
40 void throw_error(const astring &class_name, const astring &func_name,
41     const astring &error_message)
42 {
43   throw_error((base_string &)class_name, (base_string &)func_name, (base_string &)error_message);
44 }
45
46 } //namespace.
47