WvStreams
wvassert.cc
00001 /*
00002  * Worldvisions Weaver Software:
00003  *   Copyright (C) 2005 Net Integration Technologies, Inc.
00004  *
00005  * Helper classes and functions to add more information to WvCrashes.
00006  */
00007 
00008 #include "wvassert.h"
00009 
00010 WvCrashWill::WvCrashWill(const char *will)
00011     : old_will(wvcrash_read_will())
00012 {
00013     wvcrash_leave_will(will);
00014 }
00015 
00016 WvCrashWill::WvCrashWill(WVSTRING_FORMAT_DEFN)
00017     : old_will(wvcrash_read_will())
00018 {
00019     // We use a WvFastString here, because it is a temporary.  init()
00020     // will duplicate the string into a local buffer, so don't you
00021     // worry.
00022     wvcrash_leave_will(WvFastString(WVSTRING_FORMAT_CALL));
00023 }
00024 
00025 void WvCrashWill::rewrite(const char *will)
00026 {
00027     // Don't touch old_will.
00028     wvcrash_leave_will(will);
00029 }
00030 
00031 void WvCrashWill::rewrite(WVSTRING_FORMAT_DEFN)
00032 {
00033     // Again, since wvcrash_leave_will will duplicate the string, we
00034     // can use a WvFastString.
00035     rewrite(WvFastString(WVSTRING_FORMAT_CALL));
00036 }
00037 
00038 WvCrashWill::~WvCrashWill()
00039 {
00040     // Put the old will back.
00041     wvcrash_leave_will(old_will);
00042 }
00043