source: branches/1.6/src/core/RpOutcome.h @ 6131

Last change on this file since 6131 was 5679, checked in by ldelgass, 9 years ago

Full merge 1.3 branch to uq branch to sync. Fixed partial subdirectory merge
by removing mergeinfo from lang/python/Rappture directory.

  • Property svn:eol-style set to native
File size: 1.6 KB
Line 
1/*
2 * ======================================================================
3 *  Rappture::Outcome
4 *
5 *  AUTHOR:  Michael McLennan, Purdue University
6 *  Copyright (c) 2004-2012  HUBzero Foundation, LLC
7 * ----------------------------------------------------------------------
8 *  See the file "license.terms" for information on usage and
9 *  redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
10 * ======================================================================
11 */
12#ifndef RAPPTURE_OUTCOME_H
13#define RAPPTURE_OUTCOME_H
14
15#include <string>
16#include <RpPtr.h>
17
18namespace Rappture {
19
20/**
21 *  This object represents the result of any Rappture call.  It acts
22 *  like a boolean, so it can be tested for success/failure.  But
23 *  it can also contain information about failure, including a trace
24 *  back of messages indicating the cause.
25 */
26class Outcome {
27public:
28    Outcome(const char* errmsg=NULL);
29    Outcome(const Outcome& status);
30    Outcome& operator=(const Outcome& status);
31    virtual ~Outcome();
32
33    Outcome& addError(const char* format, ...);
34    virtual Outcome& error(const char* errmsg, int status=1);
35    virtual Outcome& clear();
36
37    virtual operator int() const;
38    virtual int operator!() const;
39    virtual Outcome& operator&=(Outcome status);  // pass-by-value to avoid temp
40
41    virtual const char *remark() const;
42    virtual Outcome& addContext(const char *rem);
43    virtual const char *context() const;
44
45private:
46    /// overall pass/fail status
47    int _status;
48
49    /// error message
50    std::string _remark;
51
52    /// stack trace
53    std::string _context;
54};
55
56} // namespace Rappture
57
58#endif
Note: See TracBrowser for help on using the repository browser.