WXP C++ Library Version 6.74.9
Loading...
Searching...
No Matches
File.h
1#ifndef _WINC_FILE
2#define _WINC_FILE
3
4#include <stdio.h>
5#include <WXP/Config.h>
6#ifdef USE_CURL
7#include <curl/curl.h>
8#endif
9
10#include <WXP/Buffer.h>
11#include <WXP/FileAttr.h>
12#include <WXP/String.h>
13
14namespace WXP {
15 class File : public FileAttr {
16 int type;
17 int stype;
18 FILE *fp;
19#ifdef USE_CURL
20 CURL *easy;
21 CURLM *multi;
22#endif
23 int fd;
24 void *ptr;
25 bool opened;
26 int access;
27 int shared;
28 Buffer buf;
29
30#ifdef USE_CURL
31 static size_t curl_write( char *buffer, size_t size, size_t nitems,
32 void *userp);
33 static size_t curl_header( char *buffer, size_t size, size_t nitems,
34 void *userp);
35 int curl_fill_buffer( int size );
36#endif
37
38 public:
39 int init( );
40 File( const char *file, const char *raccess );
41 File( String &file, const char *raccess );
42 File( const char *file, int raccess );
43 File();
44 ~File();
45 int open( const char *file, const char *raccess );
46 int open( String &file, const char *raccess );
47 int open( const char *file, int raccess );
48 int getLine( char *string, int len );
49 int getLine( String &string );
50 int skipLine();
51 bool isOpen();
52 int rewind();
53 int close();
54 bool endFile();
55 int scanf( const char *fmt, ... );
56 int printf( const char *fmt, ... );
57 int read( unsigned char *buf, int size, int num );
58 int read( unsigned char *buf, int size );
59 int read( Buffer &buf, int size );
60 int read( Buffer &buf );
61 int write( const unsigned char *buf, int size, int num );
62 int write( const unsigned char *buf, int size );
63 int tell();
64 int seek( int byte, int where );
66 inline int seek( int byte ){ return seek( byte, 0 ); };
67 int setShare( int mode );
68 FILE *getFP();
69
70 enum Type {
71 REG,
72 PIPE,
73 STDIO,
74 FIFO,
75 DEVICE,
76 SOCKETC,
77 SOCKETS,
78 HTTP,
79 FTP };
80
81 static const int FILE_LENGTH = 100;
82 /*
83 define file type
84 */
85 enum Format {
86 UNK,
87 WXP,
88 NETCDF,
89 GRIB,
90 BUFR,
91 UNISYS,
92 NONE };
93
94 };
95}
96#endif
This class creates a generic buffer for data.
Definition Buffer.h:5
This class accesses files.
Definition File.h:15
int tell()
Definition File.cc:600
int init()
Definition File.cc:37
bool endFile()
Definition File.cc:454
int scanf(const char *fmt,...)
Definition File.cc:465
int seek(int byte, int where)
Definition File.cc:590
int rewind()
Definition File.cc:421
int open(const char *file, const char *raccess)
Definition File.cc:94
int getLine(char *string, int len)
Definition File.cc:344
int read(unsigned char *buf, int size, int num)
Definition File.cc:507
int write(const unsigned char *buf, int size, int num)
Definition File.cc:564
int close()
Definition File.cc:430
int seek(int byte)
Definition File.h:66
int skipLine()
Definition File.cc:397
~File()
Definition File.cc:85
File()
Definition File.cc:51
int setShare(int mode)
Definition File.cc:614
bool isOpen()
Definition File.cc:273
int printf(const char *fmt,...)
Definition File.cc:486
This is a variable length string class.
Definition String.h:5
All WXP classes fall under the WXP namespace.
Definition Angle.h:4
This defines some basic file attributes.
Definition FileAttr.h:11