/* * This file is a part of Winix * and is not publicly distributed * * Copyright (c) 2011, Tomasz Sowa * All rights reserved. * */ #ifndef headerfile_winix_functions_sort #define headerfile_winix_functions_sort #include "functionbase.h" namespace Fun { class Sort : public FunctionBase { public: Sort(); bool HasAccess(); void MakeGet(); void MakePost(); private: DbItemQuery iq; std::vector item_tab; // indexes to cur->request->item_tab struct SortPair { long id; int sort_index; }; std::vector item_tab2; // from post table // for sorting item_tab struct SortHelper { Sort * psort; SortHelper(Sort * s) : psort(s) {} bool operator()(size_t t1, size_t t2); }; // for sorting item_tab2 static bool SortFun2(const SortPair & s1, const SortPair & s2); void GetDirContent(); void CreateItemTab(); void CreateItemTab2(); void UpdateSortIndex(Item & item, int sort_index); void UpdateSortIndexes(); }; } // namespace #endif