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

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