1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <comphelper/errcode.hxx>
21 #include <rtl/ustrbuf.hxx>
23 COMPHELPER_DLLPUBLIC OUString
ErrCode::toString() const
25 OUStringBuffer
buf(128);
26 buf
.append(toHexString() + "(");
28 buf
.append("Warning");
32 buf
.append(" Dynamic");
35 std::u16string_view pArea
;
41 case ErrCodeArea::Sfx
:
44 case ErrCodeArea::Inet
:
47 case ErrCodeArea::Vcl
:
50 case ErrCodeArea::Svx
:
56 case ErrCodeArea::Sbx
:
59 case ErrCodeArea::Uui
:
72 buf
.append(OUString::Concat(" Area:") + pArea
);
74 std::u16string_view pClass
;
77 case ErrCodeClass::NONE
:
80 case ErrCodeClass::Abort
:
83 case ErrCodeClass::General
:
86 case ErrCodeClass::NotExists
:
87 pClass
= u
"NotExists";
89 case ErrCodeClass::AlreadyExists
:
90 pClass
= u
"AlreadyExists";
92 case ErrCodeClass::Access
:
95 case ErrCodeClass::Path
:
98 case ErrCodeClass::Locking
:
101 case ErrCodeClass::Parameter
:
102 pClass
= u
"Parameter";
104 case ErrCodeClass::Space
:
107 case ErrCodeClass::NotSupported
:
108 pClass
= u
"NotSupported";
110 case ErrCodeClass::Read
:
113 case ErrCodeClass::Write
:
116 case ErrCodeClass::Unknown
:
119 case ErrCodeClass::Version
:
122 case ErrCodeClass::Format
:
125 case ErrCodeClass::Create
:
128 case ErrCodeClass::Import
:
131 case ErrCodeClass::Export
:
134 case ErrCodeClass::So
:
137 case ErrCodeClass::Sbx
:
140 case ErrCodeClass::Runtime
:
143 case ErrCodeClass::Compiler
:
144 pClass
= u
"Compiler";
147 buf
.append(OUString::Concat(" Class:") + pClass
+ " Code:" + OUString::number(GetCode()));
150 return buf
.makeStringAndClear();
153 COMPHELPER_DLLPUBLIC
std::ostream
& operator<<(std::ostream
& os
, const ErrCode
& err
)
155 os
<< err
.toString();
159 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */