Implemented WatchDog file watcher; verifies file changes and prints last modified time. All functions tested and working.

This commit is contained in:
Preston 2025-10-15 21:47:48 -07:00
parent 287e2c3dea
commit 0724ba05b3
4 changed files with 132 additions and 14 deletions

64
.vscode/settings.json vendored
View File

@ -1,3 +1,65 @@
{
"C_Cpp.errorSquiggles": "disabled"
"C_Cpp.errorSquiggles": "disabled",
"files.associations": {
"filesystem": "cpp",
"algorithm": "cpp",
"atomic": "cpp",
"bit": "cpp",
"cctype": "cpp",
"charconv": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"compare": "cpp",
"concepts": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"deque": "cpp",
"exception": "cpp",
"format": "cpp",
"forward_list": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"ios": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"iterator": "cpp",
"limits": "cpp",
"locale": "cpp",
"memory": "cpp",
"new": "cpp",
"optional": "cpp",
"ostream": "cpp",
"ratio": "cpp",
"sstream": "cpp",
"stack": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"string": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"typeinfo": "cpp",
"utility": "cpp",
"vector": "cpp",
"xfacet": "cpp",
"xiosbase": "cpp",
"xlocale": "cpp",
"xlocbuf": "cpp",
"xlocinfo": "cpp",
"xlocmes": "cpp",
"xlocmon": "cpp",
"xlocnum": "cpp",
"xloctime": "cpp",
"xmemory": "cpp",
"xstring": "cpp",
"xtr1common": "cpp",
"xutility": "cpp"
}
}

View File

@ -1,17 +1,48 @@
#ifndef INLINENODE_H
#define INLINENODE_H
#include "node.h"
class InlineNode : public Node{
public:
InlineNode(std::string content) : content(content);
protected:
std::string content;
#include "node.h"
#include <string>
/**
* @brief InlineNode class.
*
* Inherits from Node. Represents an inline object that is used
* by the DOM tree to convert inline tags from a markup file
* to an HTML file.
*
* @author Preston Shultz
*/
class InlineNode : public Node {
public:
InlineNode(const std::string& content) : content(content) {}
// Optional: allow access to the content
std::string getContent() const { return content; }
protected:
std::string content;
};
class TextNode : public InlineNode{};
class BoldNode : public InlineNode{};
class Italic : public InlineNode{};
class BoldItalic : public InlineNode{};
// These classes inherit the InlineNode constructor using `using`
class TextNode : public InlineNode {
public:
using InlineNode::InlineNode;
};
#endif
class BoldNode : public InlineNode {
public:
using InlineNode::InlineNode;
};
class ItalicNode : public InlineNode {
public:
using InlineNode::InlineNode;
};
class BoldItalicNode : public InlineNode {
public:
using InlineNode::InlineNode;
};
#endif // INLINENODE_H

View File

@ -1,4 +1,4 @@
#include "../lib/parser.h"
/*#include "../lib/parser.h"
#include <stdexcept>
int main(int argc, char **argv) {
@ -25,3 +25,28 @@ int main(int argc, char **argv) {
return 0;
}
*/
/**
*Preston: Test to see if watchdog works :)
*/
#include "watchDog.h"
#include <iostream>
int main() {
WatchDog wd("test/input.md");
wd.start();
std::cout << "Initial check (should do nothing if file unchanged):\n";
wd.checkFile();
std::cout << "Now, modify or create the file 'example.txt' manually and press Enter:\n";
std::cin.get(); //Wait for user to press Enter
//Check again after manual change
wd.checkFile();
std::cout << "Done testing.\n";
return 0;
}

View File

@ -1,6 +1,6 @@
# Hello world in an h1 tag
# Hello world in a h1 tag
## This is a h2 tag