From 49132eb2125d7abe6d24279bb5b6e5c79b88dffd Mon Sep 17 00:00:00 2001 From: rPatrickWarner Date: Mon, 26 Feb 2024 18:57:43 -0800 Subject: init --- .gitignore | 398 +++++++++++++++++++++ Homework8/Homework8.sln | 41 +++ Homework8/Homework8/Homework8.vcxproj | 138 +++++++ Homework8/Homework8/Homework8.vcxproj.filters | 22 ++ Homework8/Homework8/main.cpp | 24 ++ Homework8/MyStructures/Contact.hpp | 108 ++++++ Homework8/MyStructures/ContactList.hpp | 119 ++++++ Homework8/MyStructures/MyStructures.vcxproj | 136 +++++++ .../MyStructures/MyStructures.vcxproj.filters | 7 + 9 files changed, 993 insertions(+) create mode 100644 .gitignore create mode 100644 Homework8/Homework8.sln create mode 100644 Homework8/Homework8/Homework8.vcxproj create mode 100644 Homework8/Homework8/Homework8.vcxproj.filters create mode 100644 Homework8/Homework8/main.cpp create mode 100644 Homework8/MyStructures/Contact.hpp create mode 100644 Homework8/MyStructures/ContactList.hpp create mode 100644 Homework8/MyStructures/MyStructures.vcxproj create mode 100644 Homework8/MyStructures/MyStructures.vcxproj.filters diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8a30d25 --- /dev/null +++ b/.gitignore @@ -0,0 +1,398 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files +*.ncb +*.aps + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml diff --git a/Homework8/Homework8.sln b/Homework8/Homework8.sln new file mode 100644 index 0000000..a8ed990 --- /dev/null +++ b/Homework8/Homework8.sln @@ -0,0 +1,41 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34330.188 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Homework8", "Homework8\Homework8.vcxproj", "{F8F29D9D-81A6-4530-AFE2-E71934846A6D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MyStructures", "MyStructures\MyStructures.vcxproj", "{BF896E58-AEC3-431B-9FE4-6F7061977AA2}" +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 + {F8F29D9D-81A6-4530-AFE2-E71934846A6D}.Debug|x64.ActiveCfg = Debug|x64 + {F8F29D9D-81A6-4530-AFE2-E71934846A6D}.Debug|x64.Build.0 = Debug|x64 + {F8F29D9D-81A6-4530-AFE2-E71934846A6D}.Debug|x86.ActiveCfg = Debug|Win32 + {F8F29D9D-81A6-4530-AFE2-E71934846A6D}.Debug|x86.Build.0 = Debug|Win32 + {F8F29D9D-81A6-4530-AFE2-E71934846A6D}.Release|x64.ActiveCfg = Release|x64 + {F8F29D9D-81A6-4530-AFE2-E71934846A6D}.Release|x64.Build.0 = Release|x64 + {F8F29D9D-81A6-4530-AFE2-E71934846A6D}.Release|x86.ActiveCfg = Release|Win32 + {F8F29D9D-81A6-4530-AFE2-E71934846A6D}.Release|x86.Build.0 = Release|Win32 + {BF896E58-AEC3-431B-9FE4-6F7061977AA2}.Debug|x64.ActiveCfg = Debug|x64 + {BF896E58-AEC3-431B-9FE4-6F7061977AA2}.Debug|x64.Build.0 = Debug|x64 + {BF896E58-AEC3-431B-9FE4-6F7061977AA2}.Debug|x86.ActiveCfg = Debug|Win32 + {BF896E58-AEC3-431B-9FE4-6F7061977AA2}.Debug|x86.Build.0 = Debug|Win32 + {BF896E58-AEC3-431B-9FE4-6F7061977AA2}.Release|x64.ActiveCfg = Release|x64 + {BF896E58-AEC3-431B-9FE4-6F7061977AA2}.Release|x64.Build.0 = Release|x64 + {BF896E58-AEC3-431B-9FE4-6F7061977AA2}.Release|x86.ActiveCfg = Release|Win32 + {BF896E58-AEC3-431B-9FE4-6F7061977AA2}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {72DD9867-97FA-44EA-B829-06173F09D886} + EndGlobalSection +EndGlobal diff --git a/Homework8/Homework8/Homework8.vcxproj b/Homework8/Homework8/Homework8.vcxproj new file mode 100644 index 0000000..0ad5b45 --- /dev/null +++ b/Homework8/Homework8/Homework8.vcxproj @@ -0,0 +1,138 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {f8f29d9d-81a6-4530-afe2-e71934846a6d} + Homework8 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + C:\Users\rpwar\source\repos\OIT-WI-2024\Homework8\homework-8-reecepwarner\Homework8\MyStructures;$(IncludePath) + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/Homework8/Homework8/Homework8.vcxproj.filters b/Homework8/Homework8/Homework8.vcxproj.filters new file mode 100644 index 0000000..ce0c35c --- /dev/null +++ b/Homework8/Homework8/Homework8.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + \ No newline at end of file diff --git a/Homework8/Homework8/main.cpp b/Homework8/Homework8/main.cpp new file mode 100644 index 0000000..37aad74 --- /dev/null +++ b/Homework8/Homework8/main.cpp @@ -0,0 +1,24 @@ +//Name:Reece Waner + +#include "Contact.hpp" + +using namespace MyStructures; //bringing scope into the main + + +int main() +{ + + Contact newContact; + + + + + + + + + + + + return 0; +} \ No newline at end of file diff --git a/Homework8/MyStructures/Contact.hpp b/Homework8/MyStructures/Contact.hpp new file mode 100644 index 0000000..f7fda6c --- /dev/null +++ b/Homework8/MyStructures/Contact.hpp @@ -0,0 +1,108 @@ +#ifndef CONTACT_HPP +#define CONTACT_HPP + +namespace MyStructures //variables declared here act as a global variable +{ + template + class Contact + { + public: + Contact() = default; + Contact(const char* name, const short age); + + ~Contact() = default; + + Contact(const Contact& copy); //copy constructor + Contact& operator=(const Contact& rhs); //copy assignment + + Contact(Contact&& move); //move constructor + Contact& operator=(Contact&& rhs); //move assignment + + + short GetAge(); + const char* GetName(); + + void SetAge(short age); + void SetName(const char* name); + + void Print(); + + T GetCustomValue(T& newValue); + + private: + const char* name_{}; + short age_{ 0 }; + T custom_value_{}; //one type is declared, it will be custom + + + }; + + + template + Contact::Contact(const char* name, const short age) + { + } + + template + Contact::Contact(const Contact& copy) + { + } + + template + Contact& Contact::operator=(const Contact& rhs) + { + // TODO: insert return statement here + } + + template + Contact::Contact(Contact&& move) + { + } + + template + Contact& Contact::operator=(Contact&& rhs) + { + // TODO: insert return statement here + } + + + + template + short Contact::GetAge() + { + return 0; + } + + template + const char* Contact::GetName() + { + return nullptr; + } + + template + void Contact::SetAge(short age) + { + } + + template + void Contact::SetName(const char* name) + { + } + + template + inline void Contact::Print() + { + } + + template + T Contact::GetCustomValue(T& newValue) + { + custom_value_ = newValue + return T(); + } + +} + + + +#endif \ No newline at end of file diff --git a/Homework8/MyStructures/ContactList.hpp b/Homework8/MyStructures/ContactList.hpp new file mode 100644 index 0000000..dd0f4ee --- /dev/null +++ b/Homework8/MyStructures/ContactList.hpp @@ -0,0 +1,119 @@ +#ifndef CONTACT_LIST_HPP +#define CONTACT_LIST_HPP + +namespace MyStructures +{ + template + class ContactList + { + public: + ContactList() = default; + ContactList(size_t size); //Creates contact list of this size + ContactList(const C* contacts, const size_t& length); //Makes a copy of another contact list + ~ContactList(); + + ContactList(const ContactList& copy); //deep copy constructor + ContactList& operator=(const ContactList& rhs); //deep copy assignment + + ContactList(ContactList&& move); //reference(move) constructor + ContactList& operator=(ContactList&& rhs); //reference(move) assignment + + private: + C* contacts_{ nullptr }; + size_t length_{ 0 }; //entire length of array + size_t size_{ 0 }; //number of actual elements + + C* AllocateContactList(const size_t& length); + }; + template + ContactList::ContactList(size_t size) + { + contacts_ = AllocateContactList(size); + } + template + ContactList::ContactList(const C* contacts, const size_t& length) + { + contacts_ AllocateContactList(length); + for (auto i = 0u; i < length; ++i) + { + contacts_[i] = contacts[i]; + } + } + template + ContactList::~ContactList() + { + delete[] contacts_; + contacts_ = nullptr; + } + template + ContactList::ContactList(const ContactList& copy) + { + length_ = copy.length_; + size_ = copy.size_; + contacts_ = AllocateContactList(copy.length_); + + contacts_ AllocateContactList(length); + for (auto i = 0u; i < length_; ++i) + { + contacts_[i] = copy[i]; + } + + } + template + ContactList&ContactList::operator=(const ContactList& rhs) + { + if (this != &rhs) //asking if they're the same object + { + delete[] contacts_; + contacts_ = nullptr; + + contacts_ = AllocateContactList(rhs.length_); + size_ = rhs.size_; + contacts_ AllocateContactList(length); + + for (auto i = 0u; i < length_; ++i) + { + contacts_[i] = rhs[i]; + } + } + return *this; + } + template + ContactList::ContactList(ContactList&& move) + { + *this = std::move(move); //move shifts addresses + } + template + ContactList& ContactList::operator=(ContactList&& rhs) + { + if(this != &rhs) + { + delete[] contacts_; + contacts = nullptr; + + contacts_ = rhs.contacts_; + + length_ = rhs.length_; + size_ = rhs.size_; + + rhs.contacts_ = nullptr; //Invalidate the other object + } + template + C* ContactList::AllocateContactList(const size_t& length) + { + C* storage = nullptr + length_ - length; + + storage = newC[length]{}; + + return storage; + } +}; +} + + + + + + +#endif \ No newline at end of file diff --git a/Homework8/MyStructures/MyStructures.vcxproj b/Homework8/MyStructures/MyStructures.vcxproj new file mode 100644 index 0000000..92eff89 --- /dev/null +++ b/Homework8/MyStructures/MyStructures.vcxproj @@ -0,0 +1,136 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {bf896e58-aec3-431b-9fe4-6f7061977aa2} + MyStructures + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + + \ No newline at end of file diff --git a/Homework8/MyStructures/MyStructures.vcxproj.filters b/Homework8/MyStructures/MyStructures.vcxproj.filters new file mode 100644 index 0000000..deeda6d --- /dev/null +++ b/Homework8/MyStructures/MyStructures.vcxproj.filters @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file -- cgit v1.2.3