Browse Source

Renamed files, moved documentation and added command interface for go and back.

pull/1/head
stew3254 4 years ago
parent
commit
851bb4a0f2
  1. 1
      README.md
  2. 0
      docs/design.txt
  3. 0
      docs/preface.txt
  4. 0
      docs/sample_interface.txt
  5. 4
      docs/specification.txt
  6. BIN
      src/Buffer.o
  7. BIN
      src/FileBrowser
  8. 39
      src/FileBrowser.cpp
  9. 10
      src/FileBrowser.h
  10. BIN
      src/FileBrowser.o
  11. 37
      src/FileViewer.cbp
  12. 71
      src/FileViewer.depend
  13. 30
      src/FileViewer.layout
  14. 11
      src/main.cpp
  15. BIN
      src/main.o
  16. 2
      src/makefile
  17. 100
      src/pubkey
  18. 1
      src/source.sh
  19. 13
      src/test.cpp

1
README.md

@ -0,0 +1 @@
# Web Browser

0
src/design.txt → docs/design.txt

0
src/preface.txt → docs/preface.txt

0
src/sample_interface.txt → docs/sample_interface.txt

4
src/specification.txt → docs/specification.txt

@ -1,4 +1,4 @@
File Viewer
File browser
SPECIFICATION
@ -6,7 +6,7 @@ SPECIFICATION
OVERVIEW
A simple file viewer that allows the user view the contents of a text file.
A simple file browser that allows the user view the contents of a text file.
DETAILS

BIN
src/Buffer.o

BIN
src/FileBrowser

39
src/FileViewer.cpp → src/FileBrowser.cpp

@ -1,10 +1,10 @@
// FileViewer.cpp
// FileBrowser.cpp
#include "FileViewer.h"
#include "FileBrowser.h"
using namespace std;
void FileViewer::display()
void FileBrowser::display()
{
const string long_separator(50, '-');
const string short_separator(8, '-');
@ -25,13 +25,35 @@ void FileViewer::display()
cout << long_separator << endl;
buffer_.display();
cout << long_separator << endl;
cout << " next previous open quit\n";
cout << " next previous open\n";
cout << " go back quit\n";
cout << short_separator << endl;
}
void FileViewer::execute_command(char command, bool & done)
void FileBrowser::execute_command(char command, bool & done)
{
switch (command) {
case 'b': {
buffer_.back();
break;
}
case 'g': {
stringstream ss;
string temp;
int link;
cout << "go to link: ";
getline(cin, temp);
ss.str(temp);
ss >> link;
if (!ss) {
error_message_ = "Could not open " + temp;
}
if (link < 1 || link > buffer_.max_links()) {
error_message_ = "Could not open " + temp + " because the file is out of range";
}
buffer_.go(link);
break;
}
case 'n': {
buffer_.move_to_next_page();
break;
@ -58,7 +80,7 @@ void FileViewer::execute_command(char command, bool & done)
}
}
void FileViewer::run()
void FileBrowser::run()
{
cout << "Window height? ";
cin >> window_height_;
@ -66,6 +88,11 @@ void FileViewer::run()
cout << '\n';
buffer_.set_window_height(window_height_);
cout << "Maximum length? ";
cin >> maximum_length_;
cin.get(); // '\n'
cout << '\n';
bool done = false;
while (!done) {
display();

10
src/FileViewer.h → src/FileBrowser.h

@ -1,18 +1,19 @@
// FileViewer.h
// FileBrowser.h
#ifndef _FileViewer_h_
#define _FileViewer_h_
#ifndef _FileBrowser_h_
#define _FileBrowser_h_
#include <cstdlib>
#include <iostream>
#include <string>
#include <sstream>
#include "Buffer.h"
const char clear_command[] = "cls"; // for Windows
//const char clear_command[] = "clear"; // for Linux and possibly Mac's
class FileViewer
class FileBrowser
{
public:
void run();
@ -22,6 +23,7 @@ private:
void execute_command(char command, bool & done);
Buffer buffer_;
int maximum_length_;
int window_height_;
std::string error_message_;
};

BIN
src/FileBrowser.o

37
src/FileViewer.cbp

@ -1,37 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="FileViewer" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Release">
<Option output="./FileViewer" prefix_auto="1" extension_auto="1" />
<Option object_output="./" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-Wall" />
</Compiler>
<Unit filename="Buffer.cpp" />
<Unit filename="Buffer.h" />
<Unit filename="FileViewer.cpp" />
<Unit filename="FileViewer.h" />
<Unit filename="test.cpp" />
<Extensions>
<code_completion />
<envvars />
<debugger />
<lib_finder disable_auto="1" />
</Extensions>
</Project>
</CodeBlocks_project_file>

71
src/FileViewer.depend

@ -1,71 +0,0 @@
# depslib dependency file v1.0
1392679174 source:c:\users\alexis\documents\cs142\prep\fileviewer\fileviewer.cpp
"FileViewer.h"
<iostream>
<string>
1520631963 c:\users\alexis\documents\cs142\prep\fileviewer\fileviewer.h
<cstdlib>
<iostream>
<string>
"Buffer.h"
1520627022 c:\users\alexis\documents\cs142\prep\fileviewer\buffer.h
<fstream>
<iomanip>
<iostream>
<string>
<vector>
1392677214 source:c:\users\alexis\documents\cs142\prep\fileviewer\test.cpp
"FileViewer.h"
1520627231 source:c:\users\alexis\documents\cs142\prep\fileviewer\buffer.cpp
"Buffer.h"
1508255405 source:c:\users\alexis\documents\cs142\cours\fileviewer\buffer.cpp
"Buffer.h"
<fstream>
<iomanip>
<iostream>
<string>
1508255313 c:\users\alexis\documents\cs142\cours\fileviewer\buffer.h
<vector>
<string>
1508255837 source:c:\users\alexis\documents\cs142\cours\fileviewer\fileviewer.cpp
"FileViewer.h"
<iostream>
<string>
1508255790 c:\users\alexis\documents\cs142\cours\fileviewer\fileviewer.h
<string>
"Buffer.h"
1392680814 source:c:\users\alexis\documents\cs142\cours\fileviewer\test.cpp
"FileViewer.h"
1488751156 source:c:\users\alexis\documents\cs142\web\code\fileviewer\buffer.cpp
"Buffer.h"
<fstream>
<iomanip>
<iostream>
<string>
1488751111 c:\users\alexis\documents\cs142\web\code\fileviewer\buffer.h
<vector>
<string>
1392680820 source:c:\users\alexis\documents\cs142\web\code\fileviewer\fileviewer.cpp
"FileViewer.h"
<iostream>
<string>
1392680420 c:\users\alexis\documents\cs142\web\code\fileviewer\fileviewer.h
<string>
"Buffer.h"
1392677212 source:c:\users\alexis\documents\cs142\web\code\fileviewer\test.cpp
"FileViewer.h"

30
src/FileViewer.layout

@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Release" />
<File name="Buffer.cpp" open="1" top="0" tabpos="5" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="395" topLine="3" />
</Cursor>
</File>
<File name="Buffer.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="449" topLine="3" />
</Cursor>
</File>
<File name="FileViewer.h" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="461" topLine="0" />
</Cursor>
</File>
<File name="FileViewer.cpp" open="1" top="1" tabpos="4" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="458" topLine="5" />
</Cursor>
</File>
<File name="test.cpp" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="133" topLine="0" />
</Cursor>
</File>
</CodeBlocks_layout_file>

11
src/main.cpp

@ -0,0 +1,11 @@
// Launches the the browser
#include "FileBrowser.h"
int main()
{
FileBrowser browser;
browser.run();
return 0;
}

BIN
src/main.o

2
src/makefile

@ -0,0 +1,2 @@
FileBrowser: FileBrowser.o Buffer.o main.o
g++ $^ -o $@

100
src/pubkey

@ -0,0 +1,100 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFyAnIMBEAC6w8acnT+lnt2k4bfuVjAmrkzGotujMY1mOSjek2qawZbcLs2L
QwVnAz3O23CFxzKCzbChOZkN+0tL5NzS72oOiA47kjQkHW2ZDGpaBQF4NuxzG2vw
et3z72Wc/ZGZqHooncZ/Q/S+wr3GYZsutR6DnC2F0q1gAH7Lvm/+tBjpS8NLuVms
soP2NOKbwAaLW9MBtgicoC6yvKkKDIRNv4bI16OqauY/b7b+ByKOHpVDrrDGIgF3
p9GY2Gm8xMgXd7PzcNeSxv/QQ2721gMWK+wEKWzLdjcOggMOm3fRFb12K+oeUYhK
IjOlcNeXlPoidydiLbQQOskx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9TbwMq4
rIdRQi6aG188Oqrs9ryNqP90KgtUpcz0VEiaz07oU5WuTYcGXnUhhX/DzHXP59dJ
T8HAB6odTmZ93Uh0jYhj5l+Owc3IH9FFftWyhaLKY3JA9Zw/ddnnIxDYwUm42zvx
A1zB4w+AsVYI6uLsXe498kvQeRU+E0zvoiRj0/iJ57LOKFN3dttyRVQL6AU6znv4
wvhTfMeL2TPbq5cPLTIq8k3gREhB/gZ083f0iqFoBi9HIjWPxuyoqGEreSaVVs/3
XkNFbHm4zVNtRHVhW99kyQc15DCKywoIQJn0b5Vaggb2IyJXVo+2ZLkwlBMPCiyE
kAhdLl45QNSR0IuDilo+G8wIQgfLo9ONsQVSHNa8fss31fr9142xE+qC5gDWpIoG
77XisC7jTtm/158IXsE+DJ0o3AILr5P/EruAXbGH74YkZHGI76knYmXQguOa/KJ/
Ke8cgVrlGi3VjQ==
=6zuj
-----END PGP PUBLIC KEY BLOCK-----

1
src/source.sh

@ -0,0 +1 @@
alias run="make 1>/dev/null && ./FileBrowser"

13
src/test.cpp

@ -1,13 +0,0 @@
// test.cpp
//
// Launches the text editor
#include "FileViewer.h"
int main()
{
FileViewer viewer;
viewer.run();
return 0;
}
Loading…
Cancel
Save