The Pedigree Project  0.1
BootIO.h
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef BOOTIO_H
21 #define BOOTIO_H
22 
23 #include "pedigree/kernel/compiler.h"
24 #include "pedigree/kernel/processor/types.h"
25 #include "pedigree/kernel/utilities/StaticString.h"
26 #include "pedigree/kernel/utilities/utility.h"
27 
28 extern class BootIO bootIO;
29 
30 class Serial;
31 
36 class BootIO
37 {
38  public:
42  enum Colour
43  {
44  Black = 0,
45  Blue = 1,
46  Green = 2,
47  Cyan = 3,
48  Red = 4,
49  Magenta = 5,
50  Orange = 6,
51  LightGrey = 7,
52  DarkGrey = 8,
53  LightBlue = 9,
54  LightGreen = 10,
55  LightCyan = 11,
56  LightRed = 12,
57  LightMagenta = 13,
58  Yellow = 14,
59  White = 15
60  };
61 
63  BootIO() NOTHROW;
65  ~BootIO();
66 
69  void initialise();
70 
75  template <class T>
76  EXPORTED_PUBLIC void write(T &str, Colour foreColour, Colour backColour);
77 
78  private:
79  void putCharVga(const char c, Colour foreColour, Colour backColour);
80  void startColour(Serial *pSerial, Colour foreColour, Colour backColour);
81  void endColour(Serial *pSerial);
82 
86  size_t m_CursorX, m_CursorY;
87 };
88 
89 extern template EXPORTED_PUBLIC void BootIO::write<TinyStaticString>(
90  TinyStaticString &str, Colour foreColour, Colour backColour);
91 extern template EXPORTED_PUBLIC void BootIO::write<NormalStaticString>(
92  NormalStaticString &str, Colour foreColour, Colour backColour);
93 extern template EXPORTED_PUBLIC void BootIO::write<LargeStaticString>(
94  LargeStaticString &str, Colour foreColour, Colour backColour);
95 extern template EXPORTED_PUBLIC void BootIO::write<HugeStaticString>(
96  HugeStaticString &str, Colour foreColour, Colour backColour);
97 
98 #endif
EXPORTED_PUBLIC void write(T &str, Colour foreColour, Colour backColour)
Colour
Definition: BootIO.h:42
size_t m_CursorX
Definition: BootIO.h:86
BootIO() NOTHROW
Definition: BootIO.cc:28
Definition: BootIO.h:36
void initialise()
Definition: BootIO.cc:36
~BootIO()
Definition: BootIO.cc:32