vOS Library

vOS is a C++ library for providing common and simple functionality, and is released under the LGPL.

Rationale

While writing the vGUI library, I found myself adding some modules that were necessary for supporting multiple platforms, but which were not really related to writing GUI-based applications.

I wanted to keep the library as clean as possible, so I separated these lower-level functions out into another library, which I called vOS, which is short for 'Virtual Operating System'.

vOS can be used on its own to write portable command-line programs, or used with another library such as vGUI to write GUI-based programs.

vOS essentially serves to standardise on certain common low-level constructs which are either handled differently on different platforms, or which are handled in the same way, but where I found the standard API for doing so annoying. For example, it always annoys me that the standard C function call fopen() opens files in 'text mode' by default, and does CR/LF translation. I have so far been caught out 3 times by this idiosyncrasy while dealing with binary data files in my programming career - therefore my File class always opens files in binary mode by default - you have to ask for special text processing features when you open the file.

Library Overview

As a quick overview, here are the facilities that vOS provides:

  • Strings
  • String parsing
  • Disks/Files
    • File class interface
    • Filenames
    • Disk-based files
    • Memory-based files
    • File locking
    • Directory scanning
    • Volume (disk) names
    • Standard folder locations
    • Virtual Filing Systems
    • ZIP file support
      • Reading
      • Writing (single-pass only)
      • (Compression not yet supported)
  • Time/Date functions
    • Time of day
    • Date functions
    • Time (date+time of day)
    • TimeSpans
    • Monotonic Timer (millisecond timer)
  • Errors
    • Error manager
    • Error reporting
  • User Preferences
  • Socket programming (TCP/IP, UDP)
  • Misc
    • Simple linked list
    • Simple tree data structure
    • Logging facilities
    • GUIDs
    • Endian conversion macros
    • Struct packing macros
    • Reference counting
  • Debugging Support
    • Assert macro/mechanism
    • Debugger interface
    • Debug Trace output

Obviously some of this functionality is not strictly necessary in a portability layer, but is just in there as I didn't have anywhere else to put it at the time, so I just put it in vOS. An example of this is the ZIP file support, which is actually almost 100% portable, as it just uses the vOS File handling classes and Endian macros to do all the work.

Yes, vOS has its own String class. I really wanted to just use the standard C++ string class, but it has an API from hell, and is cumbersome to use - or at least it was when I tried to use it. It's a bit too STL'd up for my liking, with its reliance on iterator semantics, which makes a string processing code hard to read (in my opinion). Also, the standard string class is quite minimal, and I think that a string class is one of the few classes that should really have a 'kitchen-sink' interface, so you don't have to keep writing your own little extra string functions.

Download: vOS v1.02

Platforms: Windows

License: LGPL

Copyright: Tim Browse, 2002

Status: Completeness: 8/10, Reliability: 9/10

Installation: See the Library page.

  • ZIP file including source code and .lib file

Version History

Version 1.02 - 03/08/2002

  • Replaced missing preprocessor flags in dsp file, which somehow got lost.

Version 1.01 - 03/08/2002

  • Fixed problems with various missing header files.
  • Improved build setup, so that all that is needed to get things going is one environment variable.

Version 1.00 - 14/07/2002

  • First publically available version (that I started using version numbers with).