winix/functions/mv.h

77 lines
1.3 KiB
C++
Executable File

/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2010, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfile_winix_functions_mv
#define headerfile_winix_functions_mv
#include "functionbase.h"
namespace Fun
{
class Mv : public FunctionBase
{
public:
Mv();
bool HasAccess();
void MakePost();
private:
// destination dir
std::vector<Item*> dir_tab;
// destination file (if exists)
std::wstring file;
// for copying static files
std::wstring new_path, new_path_thumb;
std::wstring old_path, old_path_thumb;
// for static files
std::vector<Item> static_item_tab;
DbItemQuery static_iq;
// for moving content of a directory
DbItemQuery content_dir_iq;
std::vector<Item> item_tab;
// for logging
std::wstring old_url;
bool CheckAccessFromToDir();
bool CheckAccessFrom();
bool CheckAccessTo();
bool ParseDir();
bool MoveStaticFile(const std::wstring & from, const std::wstring & to);
void MoveStaticFile(Item & item);
void MoveFileOrSymlink(Item & item);
void MoveDirContent(const Item & dir);
void Prepare();
void Clear();
void MoveStaticFilesTree(const Item & dir);
void MoveDir(Item & dir);
bool IsTheSameFile(const Item & item);
void PostMoveFile();
void PostMoveDirContent();
void PostMoveDir();
};
} // namespace
#endif