binc: indent and cie
This commit is contained in:
parent
631532f100
commit
8a7e00a029
@ -1,4 +1,3 @@
|
|||||||
/* -*- mode:c++;c-basic-offset:2 -*- */
|
|
||||||
/* --------------------------------------------------------------------
|
/* --------------------------------------------------------------------
|
||||||
* Filename:
|
* Filename:
|
||||||
* src/mime-inputsource.h
|
* src/mime-inputsource.h
|
||||||
@ -25,7 +24,6 @@
|
|||||||
*/
|
*/
|
||||||
#ifndef mime_inputsource_h_included
|
#ifndef mime_inputsource_h_included
|
||||||
#define mime_inputsource_h_included
|
#define mime_inputsource_h_included
|
||||||
#include "autoconfig.h"
|
|
||||||
// Data source for MIME parser
|
// Data source for MIME parser
|
||||||
|
|
||||||
// Note about large files: we might want to change the unsigned int
|
// Note about large files: we might want to change the unsigned int
|
||||||
@ -36,7 +34,7 @@
|
|||||||
// stream input source (from a memory buffer, no file offsets). When
|
// stream input source (from a memory buffer, no file offsets). When
|
||||||
// parsing a raw message file, it's only one message.
|
// parsing a raw message file, it's only one message.
|
||||||
|
|
||||||
#include <string.h>
|
#include <cstring>
|
||||||
#include "safeunistd.h"
|
#include "safeunistd.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@ -178,14 +176,14 @@ namespace Binc {
|
|||||||
///////////////////////////////////
|
///////////////////////////////////
|
||||||
class MimeInputSourceStream : public MimeInputSource {
|
class MimeInputSourceStream : public MimeInputSource {
|
||||||
public:
|
public:
|
||||||
inline MimeInputSourceStream(istream& s, unsigned int start = 0);
|
inline MimeInputSourceStream(std::istream& s, unsigned int start = 0);
|
||||||
virtual inline ssize_t fillRaw(char *raw, size_t nb);
|
virtual inline ssize_t fillRaw(char *raw, size_t nb);
|
||||||
virtual inline void reset(void);
|
virtual inline void reset(void);
|
||||||
private:
|
private:
|
||||||
istream& s;
|
std::istream& s;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline MimeInputSourceStream::MimeInputSourceStream(istream& si,
|
inline MimeInputSourceStream::MimeInputSourceStream(std::istream& si,
|
||||||
unsigned int start)
|
unsigned int start)
|
||||||
: MimeInputSource(-1, start), s(si)
|
: MimeInputSource(-1, start), s(si)
|
||||||
{
|
{
|
||||||
@ -196,7 +194,7 @@ namespace Binc {
|
|||||||
// Why can't streams tell how many characters were actually read
|
// Why can't streams tell how many characters were actually read
|
||||||
// when hitting eof ?
|
// when hitting eof ?
|
||||||
std::streampos st = s.tellg();
|
std::streampos st = s.tellg();
|
||||||
s.seekg(0, ios::end);
|
s.seekg(0, std::ios::end);
|
||||||
std::streampos lst = s.tellg();
|
std::streampos lst = s.tellg();
|
||||||
s.seekg(st);
|
s.seekg(st);
|
||||||
size_t nbytes = size_t(lst - st);
|
size_t nbytes = size_t(lst - st);
|
||||||
|
|||||||
@ -36,15 +36,14 @@
|
|||||||
#include <exception>
|
#include <exception>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#ifndef NO_NAMESPACES
|
|
||||||
using namespace ::std;
|
|
||||||
#endif /* NO_NAMESPACES */
|
|
||||||
|
|
||||||
#include "mime.h"
|
#include "mime.h"
|
||||||
#include "mime-utils.h"
|
#include "mime-utils.h"
|
||||||
#include "mime-inputsource.h"
|
#include "mime-inputsource.h"
|
||||||
#include "convert.h"
|
#include "convert.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
// #define MPF
|
// #define MPF
|
||||||
#ifdef MPF
|
#ifdef MPF
|
||||||
#define MPFDEB(X) fprintf X
|
#define MPFDEB(X) fprintf X
|
||||||
|
|||||||
@ -40,9 +40,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#ifndef NO_NAMESPACES
|
using namespace std;
|
||||||
using namespace ::std;
|
|
||||||
#endif /* NO_NAMESPACES */
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
void Binc::MimeDocument::parseOnlyHeader(int fd)
|
void Binc::MimeDocument::parseOnlyHeader(int fd)
|
||||||
|
|||||||
@ -35,15 +35,13 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#ifndef NO_NAMESPACES
|
|
||||||
using namespace ::std;
|
|
||||||
#endif /* NO_NAMESPACES */
|
|
||||||
|
|
||||||
|
|
||||||
#include "mime.h"
|
#include "mime.h"
|
||||||
#include "convert.h"
|
#include "convert.h"
|
||||||
#include "mime-inputsource.h"
|
#include "mime-inputsource.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
Binc::MimeDocument::MimeDocument(void)
|
Binc::MimeDocument::MimeDocument(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
/* -*- mode:c++;c-basic-offset:2 -*- */
|
|
||||||
/* --------------------------------------------------------------------
|
/* --------------------------------------------------------------------
|
||||||
* Filename:
|
* Filename:
|
||||||
* src/parsers/mime/mime.h
|
* src/parsers/mime/mime.h
|
||||||
@ -25,6 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
#ifndef mime_h_included
|
#ifndef mime_h_included
|
||||||
#define mime_h_included
|
#define mime_h_included
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <map>
|
||||||
@ -57,7 +57,8 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
bool getFirstHeader(const std::string &key, HeaderItem &dest) const;
|
bool getFirstHeader(const std::string &key, HeaderItem &dest) const;
|
||||||
bool getAllHeaders(const std::string &key, std::vector<HeaderItem> &dest) const;
|
bool getAllHeaders(const std::string &key, std::vector<HeaderItem> &dest)
|
||||||
|
const;
|
||||||
void add(const std::string &name, const std::string &content);
|
void add(const std::string &name, const std::string &content);
|
||||||
void clear(void);
|
void clear(void);
|
||||||
|
|
||||||
@ -104,10 +105,13 @@ public:
|
|||||||
inline unsigned int getNofLines(void) const { return nlines; }
|
inline unsigned int getNofLines(void) const { return nlines; }
|
||||||
inline unsigned int getNofBodyLines(void) const { return nbodylines; }
|
inline unsigned int getNofBodyLines(void) const { return nbodylines; }
|
||||||
inline unsigned int getBodyLength(void) const { return bodylength; }
|
inline unsigned int getBodyLength(void) const { return bodylength; }
|
||||||
inline unsigned int getBodyStartOffset(void) const { return bodystartoffsetcrlf; }
|
inline unsigned int getBodyStartOffset(void) const {
|
||||||
|
return bodystartoffsetcrlf; }
|
||||||
|
|
||||||
void printBody(Binc::IODevice &output, unsigned int startoffset, unsigned int length) const;
|
void printBody(Binc::IODevice &output, unsigned int startoffset,
|
||||||
void getBody(std::string& s, unsigned int startoffset, unsigned int length) const;
|
unsigned int length) const;
|
||||||
|
void getBody(std::string& s, unsigned int startoffset, unsigned int length)
|
||||||
|
const;
|
||||||
virtual void clear(void);
|
virtual void clear(void);
|
||||||
|
|
||||||
virtual int doParseOnlyHeader(MimeInputSource *ms);
|
virtual int doParseOnlyHeader(MimeInputSource *ms);
|
||||||
@ -166,12 +170,10 @@ public:
|
|||||||
|
|
||||||
void clear(void);
|
void clear(void);
|
||||||
|
|
||||||
bool isHeaderParsed(void) const
|
bool isHeaderParsed(void) const {
|
||||||
{
|
|
||||||
return headerIsParsed;
|
return headerIsParsed;
|
||||||
}
|
}
|
||||||
bool isAllParsed(void) const
|
bool isAllParsed(void) const {
|
||||||
{
|
|
||||||
return allIsParsed;
|
return allIsParsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user