miniassimp

view include/miniassimp/LogStream.hpp @ 0:879c81d94345

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 28 Jan 2019 18:19:26 +0200
parents
children
line source
1 /*
2 Open Asset Import Library (assimp)
3 ----------------------------------------------------------------------
5 Copyright (c) 2006-2018, assimp team
8 All rights reserved.
10 Redistribution and use of this software in source and binary forms,
11 with or without modification, are permitted provided that the
12 following conditions are met:
14 * Redistributions of source code must retain the above
15 copyright notice, this list of conditions and the
16 following disclaimer.
18 * Redistributions in binary form must reproduce the above
19 copyright notice, this list of conditions and the
20 following disclaimer in the documentation and/or other
21 materials provided with the distribution.
23 * Neither the name of the assimp team, nor the names of its
24 contributors may be used to endorse or promote products
25 derived from this software without specific prior
26 written permission of the assimp team.
28 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 ----------------------------------------------------------------------
41 */
43 /** @file LogStream.hpp
44 * @brief Abstract base class 'LogStream', representing an output log stream.
45 */
46 #ifndef INCLUDED_AI_LOGSTREAM_H
47 #define INCLUDED_AI_LOGSTREAM_H
49 #include "types.h"
51 namespace Assimp {
53 class IOSystem;
55 // ------------------------------------------------------------------------------------
56 /** @brief CPP-API: Abstract interface for log stream implementations.
57 *
58 * Several default implementations are provided, see #aiDefaultLogStream for more
59 * details. Writing your own implementation of LogStream is just necessary if these
60 * are not enough for your purpose. */
61 class ASSIMP_API LogStream
62 #ifndef SWIG
63 : public Intern::AllocateFromAssimpHeap
64 #endif
65 {
66 protected:
67 /** @brief Default constructor */
68 LogStream() AI_NO_EXCEPT;
70 public:
71 /** @brief Virtual destructor */
72 virtual ~LogStream();
74 // -------------------------------------------------------------------
75 /** @brief Overwrite this for your own output methods
76 *
77 * Log messages *may* consist of multiple lines and you shouldn't
78 * expect a consistent formatting. If you want custom formatting
79 * (e.g. generate HTML), supply a custom instance of Logger to
80 * #DefaultLogger:set(). Usually you can *expect* that a log message
81 * is exactly one line and terminated with a single \n character.
82 * @param message Message to be written */
83 virtual void write(const char* message) = 0;
85 // -------------------------------------------------------------------
86 /** @brief Creates a default log stream
87 * @param streams Type of the default stream
88 * @param name For aiDefaultLogStream_FILE: name of the output file
89 * @param io For aiDefaultLogStream_FILE: IOSystem to be used to open the output
90 * file. Pass NULL for the default implementation.
91 * @return New LogStream instance. */
92 static LogStream* createDefaultStream(aiDefaultLogStream stream,
93 const char* name = "AssimpLog.txt",
94 IOSystem* io = 0 );
96 }; // !class LogStream
98 inline
99 LogStream::LogStream() AI_NO_EXCEPT {
100 // empty
101 }
103 inline
104 LogStream::~LogStream() {
105 // empty
106 }
108 // ------------------------------------------------------------------------------------
109 } // Namespace Assimp
111 #endif