GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/options/open_ostream.h Lines: 0 1 0.0 %
Date: 2021-03-23 Branches: 0 0 0.0 %

Line Exec Source
1
/*********************                                                        */
2
/*! \file open_ostream.h
3
 ** \verbatim
4
 ** Top contributors (to current version):
5
 **   Tim King, Mathias Preiner
6
 ** This file is part of the CVC4 project.
7
 ** Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
8
 ** in the top-level source directory and their institutional affiliations.
9
 ** All rights reserved.  See the file COPYING in the top-level source
10
 ** directory for licensing information.\endverbatim
11
 **
12
 ** \brief [[ Add one-line brief description here ]]
13
 **
14
 ** [[ Add lengthier description here ]]
15
 ** \todo document this file
16
 **/
17
18
#include "cvc4_private.h"
19
20
#ifndef CVC4__OPEN_OSTREAM_H
21
#define CVC4__OPEN_OSTREAM_H
22
23
#include <iosfwd>
24
#include <map>
25
#include <string>
26
#include <utility>
27
28
namespace CVC4 {
29
30
class OstreamOpener {
31
 public:
32
  OstreamOpener(const char* channelName);
33
34
  void addSpecialCase(const std::string& name, std::ostream* out);
35
36
  /**
37
   * If name == "", this throws OptionException with the message, messageIfEmpty.
38
   * If name is a special case, this return <false, out> where out is the
39
   *   special case that was added.
40
   * If name == "std::cerr", this return <false, &cerr>.
41
   * If none of the previous conditions hold and !options::filesystemAccess(),
42
   *   this throws an OptionException.
43
   * Otherwise, this attempts to open a ofstream using the filename, name.
44
   *   If this fails, this throws and OptionException. If this succeeds, this
45
   *   returns <true, stream> where stream is a ostream allocated by new.
46
   *   The caller is in this case the owner of the allocated memory.
47
   */
48
  std::pair<bool, std::ostream*> open(const std::string& name) const;
49
50
 private:
51
  const char* d_channelName;
52
  std::map< std::string, std::ostream* > d_specialCases;
53
54
}; /* class OstreamOpener */
55
56
std::string cvc4_errno_failreason();
57
58
}/* CVC4 namespace */
59
60
#endif /* CVC4__OPEN_OSTREAM_H */