LibreOffice Module vcl (master)  1
errcode.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <vcl/errcode.hxx>
21 
22 VCL_DLLPUBLIC std::ostream& operator<<(std::ostream& os, const ErrCode& err)
23 {
24  os << err.toHexString() << "(" << (err.IsWarning() ? "Warning" : "Error");
25  if (err.IsDynamic())
26  os << " Dynamic";
27  else
28  {
29  os << " Area:";
30  switch (err.GetArea())
31  {
32  case ErrCodeArea::Io:
33  os << "Io";
34  break;
35  case ErrCodeArea::Sfx:
36  os << "Sfx";
37  break;
38  case ErrCodeArea::Inet:
39  os << "Inet";
40  break;
41  case ErrCodeArea::Vcl:
42  os << "Vcl";
43  break;
44  case ErrCodeArea::Svx:
45  os << "Svx";
46  break;
47  case ErrCodeArea::So:
48  os << "So";
49  break;
50  case ErrCodeArea::Sbx:
51  os << "Sbx";
52  break;
53  case ErrCodeArea::Uui:
54  os << "Uui";
55  break;
56  case ErrCodeArea::Sc:
57  os << "Sc";
58  break;
59  case ErrCodeArea::Sd:
60  os << "Sd";
61  break;
62  case ErrCodeArea::Sw:
63  os << "Sw";
64  break;
65  default:
66  os << "Unknown";
67  }
68  os << " Class:";
69  switch (err.GetClass())
70  {
71  case ErrCodeClass::NONE:
72  os << "NONE";
73  break;
75  os << "Abort";
76  break;
78  os << "General";
79  break;
81  os << "NotExists";
82  break;
84  os << "AlreadyExists";
85  break;
87  os << "Access";
88  break;
89  case ErrCodeClass::Path:
90  os << "Path";
91  break;
93  os << "Locking";
94  break;
96  os << "Parameter";
97  break;
99  os << "Space";
100  break;
102  os << "NotSupported";
103  break;
104  case ErrCodeClass::Read:
105  os << "Read";
106  break;
107  case ErrCodeClass::Write:
108  os << "Write";
109  break;
111  os << "Unknown";
112  break;
114  os << "Version";
115  break;
117  os << "Format";
118  break;
120  os << "Create";
121  break;
123  os << "Import";
124  break;
126  os << "Export";
127  break;
128  case ErrCodeClass::So:
129  os << "So";
130  break;
131  case ErrCodeClass::Sbx:
132  os << "Sbx";
133  break;
135  os << "Runtime";
136  break;
138  os << "Compiler";
139  break;
140  }
141  os << " Code:" << OUString::number(err.GetCode());
142  }
143  os << ")";
144  return os;
145 }
146 
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr sal_uInt8 GetCode() const
Definition: errcode.hxx:136
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
constexpr ErrCodeArea GetArea() const
Definition: errcode.hxx:128
constexpr ErrCodeClass GetClass() const
Definition: errcode.hxx:132
bool IsWarning() const
Definition: errcode.hxx:100
bool IsDynamic() const
Definition: errcode.hxx:112
VCL_DLLPUBLIC std::ostream & operator<<(std::ostream &os, const ErrCode &err)
Definition: errcode.cxx:22
OUString toHexString() const
Definition: errcode.hxx:140