Eliminate includes file and include locally as required.
This commit is contained in:
parent
be014d0d24
commit
91286649cc
@ -1,40 +1,42 @@
|
|||||||
#ifndef __DirectoryEntry_h__
|
#ifndef __DirectoryEntry_h__
|
||||||
# define __DirectoryEntry_h__
|
# define __DirectoryEntry_h__
|
||||||
|
|
||||||
# include "includes"
|
#include <dirent.h>
|
||||||
|
#include <string>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
namespace coreutils {
|
namespace coreutils {
|
||||||
|
|
||||||
class DirectoryEntry {
|
class DirectoryEntry {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DirectoryEntry(struct dirent *entry) {
|
DirectoryEntry(struct dirent *entry) {
|
||||||
memcpy(&this->entry, entry, sizeof(struct dirent));
|
memcpy(&this->entry, entry, sizeof(struct dirent));
|
||||||
}
|
}
|
||||||
|
|
||||||
~DirectoryEntry() {}
|
~DirectoryEntry() {}
|
||||||
|
|
||||||
std::string getName() {
|
std::string getName() {
|
||||||
return std::string(entry.d_name);
|
return std::string(entry.d_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char getType() {
|
unsigned char getType() {
|
||||||
return entry.d_type;
|
return entry.d_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isFile() {
|
bool isFile() {
|
||||||
return entry.d_type == DT_REG;
|
return entry.d_type == DT_REG;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isDirectory() {
|
bool isDirectory() {
|
||||||
return entry.d_type == DT_DIR;
|
return entry.d_type == DT_DIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct dirent entry;
|
struct dirent entry;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
5
File.cpp
5
File.cpp
@ -1,5 +1,10 @@
|
|||||||
#include "File.h"
|
#include "File.h"
|
||||||
#include "Exception.h"
|
#include "Exception.h"
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sstream>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
namespace coreutils {
|
namespace coreutils {
|
||||||
|
|
||||||
|
3
File.h
3
File.h
@ -1,7 +1,8 @@
|
|||||||
#ifndef __File_h__
|
#ifndef __File_h__
|
||||||
#define __File_h__
|
#define __File_h__
|
||||||
|
|
||||||
#include "includes"
|
#include <string>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
///
|
///
|
||||||
/// File
|
/// File
|
||||||
|
@ -34,20 +34,10 @@ namespace coreutils {
|
|||||||
out << newHeaders.str() << "\r\n";
|
out << newHeaders.str() << "\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void IMFMessage::addHeader(const char *key, const char *value) {
|
void IMFMessage::addHeader(IMFHeader header) {
|
||||||
newHeaders << key << ": " << value << "\r\n";
|
std::stringstream out;
|
||||||
}
|
header.output(out);
|
||||||
|
newHeaders << out.str() ;
|
||||||
void IMFMessage::addHeader(const char *key, std::string &value) {
|
|
||||||
newHeaders << key << ": " << value << "\r\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
void IMFMessage::addHeader(ZString &key, ZString &value) {
|
|
||||||
newHeaders << key << ": " << value << "\r\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
void IMFMessage::addHeader(const char *key, ZString &value) {
|
|
||||||
newHeaders << key << ": " << value << "\r\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ZString IMFMessage::getHeader(ZString key, bool valueOnly) {
|
ZString IMFMessage::getHeader(ZString key, bool valueOnly) {
|
||||||
|
10
IMFMessage.h
10
IMFMessage.h
@ -1,6 +1,7 @@
|
|||||||
#ifndef __IMFMessage_h__
|
#ifndef __IMFMessage_h__
|
||||||
#define __IMFMessage_h__
|
#define __IMFMessage_h__
|
||||||
|
|
||||||
|
#include <typeinfo>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@ -10,6 +11,10 @@
|
|||||||
|
|
||||||
namespace coreutils {
|
namespace coreutils {
|
||||||
|
|
||||||
|
///
|
||||||
|
///
|
||||||
|
///
|
||||||
|
|
||||||
class IMFMessage : public ZString {
|
class IMFMessage : public ZString {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -19,10 +24,7 @@ namespace coreutils {
|
|||||||
|
|
||||||
void output(std::stringstream &out);
|
void output(std::stringstream &out);
|
||||||
|
|
||||||
void addHeader(const char *key, std::string &value);
|
void addHeader(IMFHeader header);
|
||||||
void addHeader(const char *key, const char *value);
|
|
||||||
void addHeader(ZString &key, ZString &value);
|
|
||||||
void addHeader(const char *key, ZString &value);
|
|
||||||
|
|
||||||
ZString getHeader(ZString key, bool valueOnly = true);
|
ZString getHeader(ZString key, bool valueOnly = true);
|
||||||
ZString getHeaderKeyPairValue(const char *headerKey, const char *key);
|
ZString getHeaderKeyPairValue(const char *headerKey, const char *key);
|
||||||
|
@ -18,12 +18,12 @@ namespace coreutils {
|
|||||||
if(mode == LENGTH) {
|
if(mode == LENGTH) {
|
||||||
sprintf(contentLength, "%li", content.str().length());
|
sprintf(contentLength, "%li", content.str().length());
|
||||||
ZString conlen(contentLength);
|
ZString conlen(contentLength);
|
||||||
addHeader("Content-Length", conlen);
|
addHeader(IMFHeader("Content-Length", conlen));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
addHeader("Transfer-Encoding", "chunked");
|
addHeader(IMFHeader("Transfer-Encoding", "chunked"));
|
||||||
|
|
||||||
addHeader("Server", "JETServer v0.0.1");
|
addHeader(IMFHeader("Server", "JETServer v0.0.1"));
|
||||||
|
|
||||||
output(response);
|
output(response);
|
||||||
response << content.str();
|
response << content.str();
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
#ifndef __IMFResponse_h__
|
#ifndef __IMFResponse_h__
|
||||||
#define __IMFResponse_h__
|
#define __IMFResponse_h__
|
||||||
|
|
||||||
#include "includes"
|
|
||||||
#include "IMFMessage.h"
|
#include "IMFMessage.h"
|
||||||
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
namespace coreutils {
|
namespace coreutils {
|
||||||
|
|
||||||
|
5
Log.cpp
5
Log.cpp
@ -1,5 +1,10 @@
|
|||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "LogListener.h"
|
#include "LogListener.h"
|
||||||
|
#include <sstream>
|
||||||
|
#include <iostream>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <sys/syscall.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
namespace coreutils {
|
namespace coreutils {
|
||||||
|
|
||||||
|
4
Log.h
4
Log.h
@ -1,9 +1,11 @@
|
|||||||
#ifndef __Log_h__
|
#ifndef __Log_h__
|
||||||
#define __Log_h__
|
#define __Log_h__
|
||||||
|
|
||||||
#include "includes"
|
|
||||||
#include "File.h"
|
#include "File.h"
|
||||||
#include "LogListener.h"
|
#include "LogListener.h"
|
||||||
|
#include <mutex>
|
||||||
|
#include <string>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
namespace coreutils {
|
namespace coreutils {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user