forked from ermaotech/CppTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFileOperation.h
33 lines (31 loc) · 857 Bytes
/
FileOperation.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef FILEOPERATION_H
#define FILEOPERATION_H
#include <stdio.h>
#include <string>
#include <vector>
#include <windows.h>
class FileOperation
{
public:
FileOperation();
FileOperation(std::string dir, std::string suffix);
~FileOperation();
std::string err_msg() const { return err_msg_;}
int error_code() const { return error_code_;}
void set_error_code(int error_code) { error_code_ = error_code;}
void set_err_msg(std::string err_msg) { err_msg_ = err_msg;}
int Count() const { return file_list_->size();}
bool RenameFile();
protected:
void FindFiles();
private:
std::string dirname_;
std::string suffix_;
std::string err_msg_;
std::vector<std::string> *file_list_;
WIN32_FIND_DATAA current_file_;
HANDLE handle_;
int error_code_;
bool FindNext();
};
#endif // FILEOPERATION_H