Add FullSkeleton example

This commit is contained in:
flithm 2007-08-29 11:24:39 +00:00
commit c315c3f0d3
75 changed files with 4452 additions and 0 deletions

View file

@ -0,0 +1,71 @@
#################################
if (BUILD_CLIENT)
#################################
# Project
##############
project(ProgramClient D)
#################################
# Dependencies
##############
#################################
# Compiler Switches
##############
include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}
)
link_directories(
${CMAKE_BINARY_DIR}/libraryA
${CMAKE_BINARY_DIR}/libraryB
)
add_definitions(
${RENDERER_DEFINITIONS}
)
#################################
# Source Files
##############
add_executable(client
ProgramClient.d
ProgramClientApp.d
ProgramClientMain.d
)
#################################
# Linking
##############
target_link_libraries(client
A
B
)
#################################
# Install Files
##############
file(GLOB sources "${CMAKE_CURRENT_SOURCE_DIR}/*.d")
install(
FILES
${sources}
DESTINATION
include/FullSkeleton
)
install(TARGETS client
RUNTIME DESTINATION bin
)
#################################
endif (BUILD_CLIENT)

View file

@ -0,0 +1,74 @@
/**
*
* Main ProgramClient Class -- This is where everything happens!
*
* Authors: Tim Burrell
* Copyright: Copyright (c) 2007
* License: <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>
*
**/
////////////////////////////////////////////////////////////////////////////
// Module
///////////////////////////////////////
module programClient.ProgramClient;
////////////////////////////////////////////////////////////////////////////
// Imports
///////////////////////////////////////
import config;
import libraryB.LibraryB;
import libraryA.io.Output;
////////////////////////////////////////////////////////////////////////////
// Definitions
///////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
// Class Definition
///////////////////////////////////////
/**
* This is the main ProgramClient class
**/
class ProgramClient : LibraryB {
////////////////////////////////////////////////////////////////////
// Construction
///////////////////////////////
/**
* Default Constructor
**/
this() {
}
/**
* Destructor
**/
~this() {
}
////////////////////////////////////////////////////////////////////
// Public Members
///////////////////////////////
////////////////////////////////////////////////////////////////////
// Public functions
///////////////////////////////
////////////////////////////////////////////////////////////////////
private:
////////////////////////////////////////////////////////////////////
// Private Functions
///////////////////////////////
////////////////////////////////////////////////////////////////////
// Private Members
///////////////////////////////
}

View file

@ -0,0 +1,128 @@
/**
*
* ProgramClientApp Class -- Common app init code encapsulation
*
* Authors: Tim Burrell
* Copyright: Copyright (c) 2007
* License: <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>
*
**/
////////////////////////////////////////////////////////////////////////////
// Module
///////////////////////////////////////
module programClient.ProgramClientApp;
////////////////////////////////////////////////////////////////////////////
// Imports
///////////////////////////////////////
import config;
import programClient.ProgramClient;
import libraryB.LibraryB;
import libraryA.io.Output;
////////////////////////////////////////////////////////////////////////////
// Definitions
///////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
// Class Definition
///////////////////////////////////////
/**
* This is the ProgramClientApp class. It is responsible for handling init stuff
* like command line parsing and so forth.
**/
class ProgramClientApp : ProgramClient {
////////////////////////////////////////////////////////////////////
// Construction
///////////////////////////////
/**
* Default Constructor
**/
this(char [][] Args) {
Out(props());
initialize(Args);
}
/**
* Destructor
**/
~this() {
Out("Shutting Down...");
}
////////////////////////////////////////////////////////////////////
// Public functions
///////////////////////////////
/**
* Get help info
**/
char [] getHelp() {
char [] output = "You must specify a renderer. Available renderers: ";
version (RendererX11)
output ~= "x11 ";
version (RendererWin)
output ~= "windows ";
return output;
}
/**
* Get the program's propers
*
* Returns: Formatted propers
**/
char [] props() {
return "\n" ~ PACKAGE ~ " v" ~ VERSION ~ " -=- (c) 2007\n";
}
////////////////////////////////////////////////////////////////////
private:
////////////////////////////////////////////////////////////////////
// Private Functions
///////////////////////////////
/**
* Initialize the program
*
* Params: Args = Command line arguments
* Throws: Exception If initialization error occurs
**/
void initialize(char [][] Args) {
if (Args.length < 2)
throw new Exception(getHelp());
bool RendererFound = false;
version (RendererX11) {
if (Args[1] == "x11") {
mRendererClass = RendererClass.RendererX11;
RendererFound = true;
}
}
version (RendererWin) {
if (Args[1] == "windows") {
mRendererClass = RendererClass.RendererWin;
RendererFound = true;
}
}
if (RendererFound)
ProgramClient.initialize(mRendererClass);
else
throw new Exception(getHelp());
}
////////////////////////////////////////////////////////////////////
// Private Members
///////////////////////////////
RendererClass mRendererClass; /// Renderer class
}

View file

@ -0,0 +1,52 @@
/**
*
* FullSkeleton -- A skeleton for your CMakeD app
*
* Authors: Tim Burrell
* Copyright: Copyright (c) 2007
* License: <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>
*
**/
////////////////////////////////////////////////////////////////////////////
// Module
///////////////////////////////////////
module programClient.ProgramClientMain;
////////////////////////////////////////////////////////////////////////////
// Imports
///////////////////////////////////////
import config;
import programClient.ProgramClientApp;
import libraryA.io.Output;
////////////////////////////////////////////////////////////////////////////
// Main
///////////////////////////////////////
/**
* Main function
**/
void main(char [][] Args) {
// create the App
scope ProgramClientApp App;
try {
App = new ProgramClientApp(Args);
} catch (Exception e) {
Out("Unable to Initialize " ~ PACKAGE ~ ":\n " ~ e.msg ~ "\n");
return -1;
}
// run the app
try {
App.enterLoop();
} catch (Exception e) {
Out("Unable to Run " ~ PACKAGE ~ ": " ~ e.msg ~ "\n");
return -1;
}
}