Add Application

This commit is contained in:
Grayson Riffe 2023-08-30 08:25:49 -05:00
parent 0f83170c43
commit ba68c396d2
5 changed files with 47 additions and 1 deletions

View File

@ -90,8 +90,12 @@
</PreBuildEvent> </PreBuildEvent>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="src\Application.cpp" />
<ClCompile Include="src\main.cpp" /> <ClCompile Include="src\main.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ClInclude Include="src\Application.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>

View File

@ -18,5 +18,13 @@
<ClCompile Include="src\main.cpp"> <ClCompile Include="src\main.cpp">
<Filter>Source Files</Filter> <Filter>Source Files</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\Application.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\Application.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -0,0 +1,14 @@
#include "Application.h"
namespace wc {
Application::Application(std::string& appName, std::string& appVersion)
: m_appName(appName)
, m_appVersion(appVersion)
{
std::printf("%s %s\n", m_appName.c_str(), m_appVersion.c_str());
}
Application::~Application() {
}
}

14
WinChat/src/Application.h Normal file
View File

@ -0,0 +1,14 @@
#pragma once
#include <string>
namespace wc {
class Application {
public:
Application(std::string& appName, std::string& appVersion);
~Application();
private:
const std::string m_appName;
const std::string m_appVersion;
};
}

View File

@ -1,11 +1,17 @@
#include <iostream> #include <iostream>
#include "version.h" #include "version.h"
#include "Application.h"
#define APPNAME "WinChat" #define APPNAME "WinChat"
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
std::printf(APPNAME " " APPVERSION "\n"); std::string appName = APPNAME;
std::string appVer = APPVERSION;
{
wc::Application app(appName, appVer);
}
std::cin.get(); std::cin.get();
return EXIT_SUCCESS; return EXIT_SUCCESS;