THIS IS C++ QUESTION Create an application that is used to scaffold out and modi
ID: 665904 • Letter: T
Question
THIS IS C++ QUESTION
Create an application that is used to scaffold out and modify a simple blogging website. Data persistence should be acheived through the reading and writing to files.
Required Functionality
Read site data from files into memory
Add new site content (blogs) through a command line interface
Modify site content and configuration through a command line interface
Save additions and changes to files
Include and link multiple blogs
Include multiple stylesheets
Include multiple scripts
Build functionality that will generate valid html files and site structure:
A home / landing page, index.html, that will list and link all of the blogs and display the name of the site
A page for each blog
Classes
At a minimum a Site and Blog class will be required. Classes should be contructed with proper object-oriented practices in mind. Private variables should be utilized and getters and setters should be implemented.
Site Properties
site name
blogs
css files
js files
Blog Properties
blog name
author
date posted
content
File Specifications
Data will be read from and saved to three different types of files. The differernt file types are as follows:
SITE CONFIGURATION
The site configuration file, site-config.txt, specifies properties that relate to the site in general. Three commands should be parsed by the program: name, style, and script. The application should be able to handle multiple css and js files.
site-config.txt example:
name "My C++ Blog"
style "bootstrap.min.css"
style "master.css"
script "bootstrap.min.js"
script "jquery.min.js"
script "master.js"
BLOG INDEX
The blog index file, blog-index.txt, specifies a list of blog entries. Each value should be enclosed in quotes and rows of this file will be formatted as such:
<Name> <Author> <Date> <Path>
blog-index.txt example:
"Lorem Ipsum" "John Smith" "January 1, 1970" "lorem.txt"
"Dolor Sit" "Frank Jones" "July 2 1985" "dolor.txt"
BLOG CONTENT
A blog content file will exist for each blog entry. The format is expected to be paragraphs separated by full line spaces. The name of the file can be anything as it will be linked to the application by the blog index file.
Blog example lorem.txt:
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat.
Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Explanation / Answer
#include #include #include #include #include #include using std::string; class OsSendfileTest : public TemporaryDirectoryTest { public: OsSendfileTest() : LOREM_IPSUM( "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do " "eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim " "ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut " "aliquip ex ea commodo consequat. Duis aute irure dolor in " "reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla " "pariatur. Excepteur sint occaecat cupidatat non proident, sunt in " "culpa qui officia deserunt mollit anim id est laborum.") {} protected: virtual void SetUp() { TemporaryDirectoryTest::SetUp(); filename = "lorem.txt"; ASSERT_SOME(os::write(filename, LOREM_IPSUM)); } const string LOREM_IPSUM; string filename; }; TEST_F(OsSendfileTest, sendfile) { Try fd = os::open(filename, O_RDONLY | O_CLOEXEC); ASSERT_SOME(fd); // Construct a socket pair and use sendfile to transmit the text. int s[2]; ASSERT_NE(-1, socketpair(AF_UNIX, SOCK_STREAM, 0, s))Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.