Moved to new folders
This commit is contained in:
31
Oving8/Oving 8.sln
Normal file
31
Oving8/Oving 8.sln
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28307.329
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Oving 8", "Oving 8\Oving 8.vcxproj", "{53687F7B-9262-43A3-BF31-53624DEF936E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{53687F7B-9262-43A3-BF31-53624DEF936E}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{53687F7B-9262-43A3-BF31-53624DEF936E}.Debug|x64.Build.0 = Debug|x64
|
||||
{53687F7B-9262-43A3-BF31-53624DEF936E}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{53687F7B-9262-43A3-BF31-53624DEF936E}.Debug|x86.Build.0 = Debug|Win32
|
||||
{53687F7B-9262-43A3-BF31-53624DEF936E}.Release|x64.ActiveCfg = Release|x64
|
||||
{53687F7B-9262-43A3-BF31-53624DEF936E}.Release|x64.Build.0 = Release|x64
|
||||
{53687F7B-9262-43A3-BF31-53624DEF936E}.Release|x86.ActiveCfg = Release|Win32
|
||||
{53687F7B-9262-43A3-BF31-53624DEF936E}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {2CB6B98D-907B-4A88-9154-212F757BF9FE}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
21
Oving8/Oving 8/Car.cpp
Normal file
21
Oving8/Oving 8/Car.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "Car.h"
|
||||
|
||||
|
||||
|
||||
Car::Car(unsigned int freeSeats) :
|
||||
freeSeats{freeSeats}
|
||||
{
|
||||
}
|
||||
|
||||
bool Car::hasFreeSeats() const
|
||||
{
|
||||
if (freeSeats > 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void Car::reserveFreeSeat()
|
||||
{
|
||||
--freeSeats;
|
||||
}
|
||||
|
||||
13
Oving8/Oving 8/Car.h
Normal file
13
Oving8/Oving 8/Car.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
class Car
|
||||
{
|
||||
unsigned int freeSeats;
|
||||
public:
|
||||
Car(unsigned int freeSeats);
|
||||
|
||||
bool hasFreeSeats() const;
|
||||
void reserveFreeSeat();
|
||||
|
||||
virtual ~Car() {};
|
||||
};
|
||||
|
||||
124
Oving8/Oving 8/Meeting.cpp
Normal file
124
Oving8/Oving 8/Meeting.cpp
Normal file
@@ -0,0 +1,124 @@
|
||||
#include "Meeting.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Meeting::Meeting(int d, int sT, int eT, Campus loc, string sub, Person * lead) :
|
||||
day{ d }, startTime{ sT }, endTime{ eT }, location{ loc }, subject{ sub }, leader{ lead }
|
||||
{
|
||||
addParticipant(lead);
|
||||
meetings.emplace(this);
|
||||
}
|
||||
|
||||
int Meeting::getDay() const
|
||||
{
|
||||
return day;
|
||||
}
|
||||
|
||||
int Meeting::getStartTime() const
|
||||
{
|
||||
return startTime;
|
||||
}
|
||||
|
||||
int Meeting::getEndTime() const
|
||||
{
|
||||
return endTime;
|
||||
}
|
||||
|
||||
Campus Meeting::getLocation() const
|
||||
{
|
||||
return location;
|
||||
}
|
||||
|
||||
string Meeting::getSubject() const
|
||||
{
|
||||
return subject;
|
||||
}
|
||||
|
||||
const Person* Meeting::getLeader() const
|
||||
{
|
||||
return leader;
|
||||
}
|
||||
|
||||
void Meeting::addParticipant(Person * person)
|
||||
{
|
||||
participants.emplace(person);
|
||||
}
|
||||
|
||||
set<const Person*> Meeting::getParticipants() const
|
||||
{
|
||||
return participants;
|
||||
|
||||
}
|
||||
|
||||
vector<string> Meeting::getParticipantList() const
|
||||
{
|
||||
vector<string> names;
|
||||
for (auto p : participants)
|
||||
{
|
||||
names.push_back(p->getName());
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
vector<const Person*> Meeting::findPotentialCoDriving() const
|
||||
{
|
||||
vector<const Person*> drivers;
|
||||
|
||||
for (const auto m : meetings)
|
||||
{
|
||||
if (m->getLocation() == this->location) {
|
||||
if (m->getDay() == this->day &&
|
||||
abs(m->getStartTime() - this->startTime) <= 100 &&
|
||||
abs(m->getEndTime() - this->endTime) <= 100)
|
||||
{
|
||||
for (const auto p : m->getParticipants()) {
|
||||
if (p->hasAvalibleSeats())
|
||||
drivers.push_back(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return drivers;
|
||||
}
|
||||
|
||||
ostream & operator<<(ostream & os, const Campus & c)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case Campus::Trondheim: os << "Trondheim";
|
||||
break;
|
||||
case Campus::<EFBFBD>lesund: os << "<EFBFBD>lesund";
|
||||
break;
|
||||
case Campus::Gj<EFBFBD>vik: os << "Gj<EFBFBD>vik";
|
||||
break;
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
ostream& operator<<(ostream & os, const Meeting & m)
|
||||
{
|
||||
os << "Subject: " << m.getSubject() << endl;
|
||||
os << "Location: " << m.getLocation() << endl;
|
||||
os << "Starttime: " << m.getStartTime() << endl;
|
||||
os << "Endtime: " << m.getEndTime() << endl;
|
||||
os << "Leader: " << m.getLeader()->getName() << endl;
|
||||
os << "Participants: " << endl;
|
||||
|
||||
for (auto p : m.getParticipantList())
|
||||
{
|
||||
os << p << endl;
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
set<const Meeting*> Meeting::meetings;
|
||||
|
||||
|
||||
|
||||
Meeting::~Meeting()
|
||||
{
|
||||
meetings.erase(this);
|
||||
}
|
||||
62
Oving8/Oving 8/Meeting.h
Normal file
62
Oving8/Oving 8/Meeting.h
Normal file
@@ -0,0 +1,62 @@
|
||||
#pragma once
|
||||
|
||||
#include "std_lib_facilities.h"
|
||||
#include "Person.h"
|
||||
|
||||
enum class Campus
|
||||
{
|
||||
Trondheim,
|
||||
<EFBFBD>lesund,
|
||||
Gj<EFBFBD>vik
|
||||
};
|
||||
|
||||
ostream& operator<<(ostream& os, const Campus& c);
|
||||
|
||||
|
||||
class Meeting
|
||||
{
|
||||
int day;
|
||||
int startTime;
|
||||
int endTime;
|
||||
|
||||
Campus location;
|
||||
|
||||
string subject;
|
||||
|
||||
const Person* leader;
|
||||
|
||||
set<const Person*> participants;
|
||||
|
||||
static set<const Meeting*> meetings;
|
||||
|
||||
public:
|
||||
Meeting(int d, int sT, int eT, Campus loc, string sub, Person* lead);
|
||||
|
||||
int getDay() const;
|
||||
int getStartTime() const;
|
||||
int getEndTime() const;
|
||||
|
||||
Campus getLocation() const;
|
||||
|
||||
string getSubject() const;
|
||||
|
||||
const Person* getLeader() const;
|
||||
|
||||
void addParticipant(Person* person);
|
||||
|
||||
set<const Person*> getParticipants() const;
|
||||
vector<string> getParticipantList() const;
|
||||
|
||||
vector<const Person*> findPotentialCoDriving() const;
|
||||
|
||||
~Meeting();
|
||||
};
|
||||
|
||||
ostream& operator<<(ostream& os, const Meeting& m);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
51
Oving8/Oving 8/MeetingWindow.cpp
Normal file
51
Oving8/Oving 8/MeetingWindow.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
#include "MeetingWindow.h"
|
||||
|
||||
using namespace Graph_lib;
|
||||
|
||||
|
||||
Vector_ref<Person> MeetingWindow::getPeople()
|
||||
{
|
||||
return people;
|
||||
}
|
||||
|
||||
MeetingWindow::MeetingWindow(Point xy, int w, int h, const string & title) :
|
||||
Window{ xy, w, h, title },
|
||||
quitBtn{ Point{x_max() - pad - btnW, pad }, btnW, btnH, "Quit", cb_quit },
|
||||
newPersBtn{ newPersPos, btnW, btnH, "New Person", cb_newPers },
|
||||
name{nameInPos, fieldW, fieldH, "Name"},
|
||||
email{mailInPos, fieldW, fieldH, "E-Mail"}
|
||||
{
|
||||
attach(quitBtn);
|
||||
attach(newPersBtn);
|
||||
attach(name);
|
||||
attach(email);
|
||||
|
||||
ti = title;
|
||||
}
|
||||
|
||||
void MeetingWindow::cb_quit(Address, Address pw) { reference_to<MeetingWindow>(pw).quit(); }
|
||||
|
||||
void MeetingWindow::cb_newPers(Address, Address pw){ reference_to<MeetingWindow>(pw).newPers(); }
|
||||
|
||||
void MeetingWindow::newPers()
|
||||
{
|
||||
cout << name.get_string() << " --- " << email.get_string() << endl;
|
||||
people.push_back(new Person{ name.get_string(), email.get_string() });
|
||||
//redraw();
|
||||
}
|
||||
/*
|
||||
MeetingWindow::~MeetingWindow()
|
||||
{
|
||||
/*
|
||||
for (Person* p : people)
|
||||
{
|
||||
delete p;
|
||||
}
|
||||
|
||||
for (Vector_ref<Person>::iterator it = people.begin(); it != people.end(); ++it)
|
||||
{
|
||||
delete (*it);
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
53
Oving8/Oving 8/MeetingWindow.h
Normal file
53
Oving8/Oving 8/MeetingWindow.h
Normal file
@@ -0,0 +1,53 @@
|
||||
#pragma once
|
||||
#include "GUI.h"
|
||||
#include "Graph.h"
|
||||
#include "Meeting.h"
|
||||
#include "std_lib_facilities.h"
|
||||
|
||||
using namespace Graph_lib;
|
||||
|
||||
class MeetingWindow : public Graph_lib::Window
|
||||
{
|
||||
static constexpr int pad = 50;
|
||||
static constexpr int fieldPad = 100;
|
||||
static constexpr int fieldH = 50;
|
||||
static constexpr int fieldW = 200;
|
||||
static constexpr int btnH = 50;
|
||||
static constexpr int btnW = 100;
|
||||
|
||||
static constexpr Point nameInPos{ pad, pad };
|
||||
static constexpr Point mailInPos{ pad, nameInPos.y + fieldH + pad };
|
||||
static constexpr Point newPersPos{ pad, mailInPos.y + fieldH + pad };
|
||||
|
||||
|
||||
Button quitBtn;
|
||||
Button newPersBtn;
|
||||
|
||||
In_box name;
|
||||
In_box email;
|
||||
|
||||
string ti;
|
||||
|
||||
Vector_ref<Person> people;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
Vector_ref<Person> getPeople();
|
||||
|
||||
MeetingWindow(Point xy, int w, int h, const string& title);
|
||||
|
||||
// Callback
|
||||
static void cb_quit(Address, Address pw); // cb for quitbtn
|
||||
static void cb_newPers(Address, Address pw); // cb for newPersBtn
|
||||
|
||||
|
||||
// Callback-functions
|
||||
void quit() { cout << ti + ": quit called\n"; hide(); } // action to be done when quit_button is pressed
|
||||
void newPers();
|
||||
|
||||
|
||||
|
||||
//~MeetingWindow();
|
||||
};
|
||||
|
||||
168
Oving8/Oving 8/Oving 8.vcxproj
Normal file
168
Oving8/Oving 8/Oving 8.vcxproj
Normal file
@@ -0,0 +1,168 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Car.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="Meeting.cpp" />
|
||||
<ClCompile Include="MeetingWindow.cpp" />
|
||||
<ClCompile Include="Person.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Car.h" />
|
||||
<ClInclude Include="Meeting.h" />
|
||||
<ClInclude Include="MeetingWindow.h" />
|
||||
<ClInclude Include="Person.h" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>15.0</VCProjectVersion>
|
||||
<ProjectGuid>{53687f7b-9262-43a3-bf31-53624def936e}</ProjectGuid>
|
||||
<RootNamespace>Oving_8</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v141</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>C:\Program Files\TDT4102\includes;$(ProjectDir);C:\Program Files\TDT4102\Graph_lib\Graph;$(VCInstallDir);C:\Program Files\TDT4102\FLTK_1.3.4-2;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>C:\Program Files\TDT4102\Graph_lib\lib32;C:\Program Files\TDT4102\FLTK_1.3.4-2\lib32;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>C:\Program Files\TDT4102\includes;$(ProjectDir);C:\Program Files\TDT4102\Graph_lib\Graph;$(VCInstallDir);C:\Program Files\TDT4102\FLTK_1.3.4-2;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>C:\Program Files\TDT4102\Graph_lib\lib32;C:\Program Files\TDT4102\FLTK_1.3.4-2\lib32;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>C:\Program Files\TDT4102\includes;$(ProjectDir);C:\Program Files\TDT4102\Graph_lib\Graph;$(VCInstallDir);C:\Program Files\TDT4102\FLTK_1.3.4-2;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>C:\Program Files\TDT4102\Graph_lib\lib64;C:\Program Files\TDT4102\FLTK_1.3.4-2\lib64;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>C:\Program Files\TDT4102\includes;$(ProjectDir);C:\Program Files\TDT4102\Graph_lib\Graph;$(VCInstallDir);C:\Program Files\TDT4102\FLTK_1.3.4-2;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>C:\Program Files\TDT4102\Graph_lib\lib64;C:\Program Files\TDT4102\FLTK_1.3.4-2\lib64;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PreprocessorDefinitions>NOGDI;WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>Graph_libd.lib;fltkd.lib;wsock32.lib;comctl32.lib;fltkjpegd.lib;fltkimagesd.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PreprocessorDefinitions>NOGDI;WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>Graph_libd.lib;fltkd.lib;wsock32.lib;comctl32.lib;fltkjpegd.lib;fltkimagesd.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PreprocessorDefinitions>NOGDI;WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>Graph_lib.lib;fltk.lib;wsock32.lib;comctl32.lib;fltkjpeg.lib;fltkimages.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PreprocessorDefinitions>NOGDI;WIN32;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>Graph_lib.lib;fltk.lib;wsock32.lib;comctl32.lib;fltkjpeg.lib;fltkimages.lib;;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
48
Oving8/Oving 8/Oving 8.vcxproj.filters
Normal file
48
Oving8/Oving 8/Oving 8.vcxproj.filters
Normal file
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Car.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Person.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Meeting.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MeetingWindow.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Car.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Person.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Meeting.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MeetingWindow.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
39
Oving8/Oving 8/Person.cpp
Normal file
39
Oving8/Oving 8/Person.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
#include "Person.h"
|
||||
|
||||
|
||||
|
||||
Person::Person(string name, string email, Car* car) :
|
||||
name{ name }, email{ email }, car{ car }
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
string Person::getName() const
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
string Person::getEmail() const
|
||||
{
|
||||
return email;
|
||||
}
|
||||
|
||||
bool Person::hasAvalibleSeats() const
|
||||
{
|
||||
if (car != nullptr)
|
||||
return car->hasFreeSeats();
|
||||
return false;
|
||||
}
|
||||
|
||||
void Person::setEmail(string newEmail)
|
||||
{
|
||||
email = newEmail;
|
||||
}
|
||||
|
||||
ostream & operator<<(ostream & os, const Person & p)
|
||||
{
|
||||
string seats = "No";
|
||||
if (p.hasAvalibleSeats())
|
||||
seats = "Yes";
|
||||
return os << "Name: " << p.name << "\nE-Mail: " << p.email << "\nHas free seats: " << seats << endl;
|
||||
}
|
||||
30
Oving8/Oving 8/Person.h
Normal file
30
Oving8/Oving 8/Person.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
#include "std_lib_facilities.h"
|
||||
#include "Car.h"
|
||||
|
||||
class Person
|
||||
{
|
||||
string name, email;
|
||||
Car* car;
|
||||
public:
|
||||
Person(string name, string email, Car* car = nullptr);
|
||||
|
||||
string getName() const;
|
||||
string getEmail() const;
|
||||
|
||||
bool hasAvalibleSeats() const;
|
||||
|
||||
void setEmail(string newEmail);
|
||||
|
||||
friend ostream& operator<<(ostream& os, const Person& p);
|
||||
|
||||
/*
|
||||
operatoren burde ha const fordi den ikke skal kunne endre p<> personen n<>r den skal skrives ut.
|
||||
|
||||
Dersom vi <20>nsker <20> endre p<> dataen kan vi ikke bruke const
|
||||
Const er kjekt <20> bruke slik at vi er sikre p<> at dataen ikke kan endres etter at vi sender den til en funksjon
|
||||
*/
|
||||
|
||||
virtual ~Person() {};
|
||||
};
|
||||
|
||||
56
Oving8/Oving 8/main.cpp
Normal file
56
Oving8/Oving 8/main.cpp
Normal file
@@ -0,0 +1,56 @@
|
||||
// Example program in TDT4102_Graphics template, from PPP page 415
|
||||
#include "GUI.h"
|
||||
#include "Graph.h"
|
||||
#include "MeetingWindow.h"
|
||||
|
||||
|
||||
// The following pragma turns off the console
|
||||
//#pragma comment(linker, "/SUBSYSTEM:windows /ENTRY:mainCRTStartup")
|
||||
|
||||
using namespace Graph_lib;
|
||||
|
||||
int main() {
|
||||
|
||||
/*
|
||||
Car c1{ 5 };
|
||||
Car c2{ 0 };
|
||||
Car c3{ 4 };
|
||||
|
||||
|
||||
Person p1{ "Oyvind", "mail", &c1 };
|
||||
Person p2{ "Ulrik", "mail2" };
|
||||
Person p3{ "Live", "mail3", &c2 };
|
||||
Person p4{ "Per", "mail4", &c3 };
|
||||
|
||||
|
||||
cout << p1 << endl;
|
||||
cout << p2 << endl;
|
||||
cout << p3 << endl;
|
||||
|
||||
|
||||
Meeting m1{ 13, 1300, 1500, Campus::Trondheim, "Test", &p1 };
|
||||
m1.addParticipant(&p2);
|
||||
m1.addParticipant(&p3);
|
||||
|
||||
Meeting m2{ 13, 1200, 1500, Campus::Trondheim, "Test", &p4 };
|
||||
|
||||
cout << m1;
|
||||
|
||||
m1.findPotentialCoDriving();
|
||||
|
||||
*/
|
||||
|
||||
MeetingWindow win{Point{100, 100}, 600, 400, "Meetings" };
|
||||
|
||||
gui_main();
|
||||
|
||||
for (const auto p : win.getPeople())
|
||||
{
|
||||
cout << p->getName() << endl;
|
||||
}
|
||||
|
||||
keep_window_open();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
BIN
Oving8/Utdelt_frivillig_del.zip
Normal file
BIN
Oving8/Utdelt_frivillig_del.zip
Normal file
Binary file not shown.
BIN
Oving8/Øving_8(27.feb).pdf
Normal file
BIN
Oving8/Øving_8(27.feb).pdf
Normal file
Binary file not shown.
Reference in New Issue
Block a user