Formatting

This commit is contained in:
zvon 2019-06-01 21:54:45 +02:00
parent d2ae8ab94c
commit d36d7a385d
10 changed files with 51 additions and 25 deletions

24
.clang-format Normal file
View File

@ -0,0 +1,24 @@
---
AccessModifierOffset: -4
AllowShortFunctionsOnASingleLine: Empty
BasedOnStyle: LLVM
ConstructorInitializerAllOnOneLineOrOnePerLine: 'false'
ConstructorInitializerIndentWidth: 8
Cpp11BracedListStyle: 'false'
IndentWidth: '4'
Language: Cpp
PointerAlignment: Right
SortIncludes: 'true'
SpaceBeforeAssignmentOperators: 'true'
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: 'false'
SpacesInAngles: 'true'
SpacesInCStyleCastParentheses: 'true'
SpacesInContainerLiterals: 'true'
SpacesInParentheses: 'true'
SpacesInSquareBrackets: 'false'
Standard: Cpp11
TabWidth: '4'
UseTab: Never
...

View File

@ -118,7 +118,6 @@ public:
return dir_path.c_str();
}
private:
string dir_path;
};

View File

@ -193,8 +193,8 @@ void iterateFS( std::map< int, std::set< string > > &seasons,
// if file is a correct format, add it to file list
// for its season
if ( searchSeason( p, season_pos ) )
seasons[std::stoi( p + season_pos )].insert(
path + dir_divider + p );
seasons[std::stoi( p + season_pos )].insert( path + dir_divider +
p );
}
}
@ -286,11 +286,13 @@ void printHelp() {
cout << "Usage:" << std::endl;
cout << " tv_rename [options] [path]" << std::endl << std::endl;
cout << " -h, --help show this help message and exit"
<< std::endl << std::endl;
<< std::endl
<< std::endl;
cout << " path can be either a file or a directory, if it's a directory"
<< std::endl;
cout << " all files in it and its subdirectories will be renamed"
<< std::endl << std::endl;
<< std::endl
<< std::endl;
cout << "OPTIONS" << std::endl;
cout << " -s, --show <string> TV show from which you want the";
cout << " episode names" << std::endl;
@ -394,11 +396,10 @@ getPossibleShows( string show, const string &language, Curl &c ) {
show = encodeUrl( show );
#ifdef _WIN32
auto source_code = utf8_to_wstring(
c.execute( TEXT( "https://www.thetvdb.com/search?q=" ) +
show + TEXT( "&l=" ) + language ) );
c.execute( TEXT( "https://www.thetvdb.com/search?q=" ) + show +
TEXT( "&l=" ) + language ) );
#else
auto source_code =
c.execute( TEXT( "https://www.thetvdb.com/search?q=" ) +
auto source_code = c.execute( TEXT( "https://www.thetvdb.com/search?q=" ) +
show + TEXT( "&l=" ) + language );
#endif
size_t pos{};

View File

@ -1,5 +1,5 @@
#include <iostream>
#include "network.hpp"
#include <iostream>
#ifdef _WIN32

View File

@ -3,8 +3,8 @@
#ifdef _WIN32
#include <Windows.h>
#include <WinInet.h>
#include <Windows.h>
using string = std::wstring;

View File

@ -1,5 +1,5 @@
#include <string>
#include "seasonwindow.hpp"
#include <string>
void SeasonWindow::confirm() {
// go through all checkbuttons and save numbers

View File

@ -13,10 +13,10 @@
#ifndef GUI
#include "filesystem.hpp"
#include <iostream>
#include <sstream>
#include <vector>
#include "filesystem.hpp"
#endif

View File

@ -1,9 +1,10 @@
#include <sys/stat.h>
#include "../filesystem.hpp"
#include <sys/stat.h>
FSLib::Directory::Directory( const string &path_ ) : dir_path( path_ ) {}
FSLib::Directory::Iterator::Iterator( const Directory &d_ ) : d( opendir( d_.path() ) ) {
FSLib::Directory::Iterator::Iterator( const Directory &d_ )
: d( opendir( d_.path() ) ) {
current_entry = readdir( d );
if ( current_entry != nullptr &&
( !strcmp( current_entry->d_name, "." ) ||
@ -11,7 +12,8 @@ FSLib::Directory::Iterator::Iterator( const Directory &d_ ) : d( opendir( d_.pat
++( *this );
}
FSLib::Directory::Iterator::Iterator( const Directory &d_, const struct dirent *current_entry_ )
FSLib::Directory::Iterator::Iterator( const Directory &d_,
const struct dirent *current_entry_ )
: d( opendir( d_.path() ) ), current_entry( current_entry_ ) {}
FSLib::Directory::Iterator::~Iterator() {

View File

@ -1,6 +1,6 @@
#include "../filesystem.hpp"
#include <Shlwapi.h>
#include <windows.h>
#include "../filesystem.hpp"
FSLib::Directory::Directory( const string &path_ ) : dir_path( path_ ) {
// need to append \\* for windows to search files in directory