[11590] Cleanups for barGoLink

* Rename barGoLink -> BarGoLink as expected by mangos code style
* Add uint32/uint6 constructor versions for BarGoLink,
  and remove lot casts required before for BarGoLink use
This commit is contained in:
VladimirMangos 2011-06-03 11:46:48 +04:00
parent 6b8f9fe03d
commit c870ef324d
26 changed files with 430 additions and 410 deletions

View file

@ -223,8 +223,8 @@ void SQLStorageLoaderBase<T>::Load(SQLStorage &store, bool error_at_empty /*= tr
memset(newIndex,0,maxi*sizeof(char*));
char * _data= new char[store.RecordCount *recordsize];
uint32 count=0;
barGoLink bar( store.RecordCount );
uint32 count = 0;
BarGoLink bar(store.RecordCount);
do
{
fields = result->Fetch();

View file

@ -860,7 +860,7 @@ void Log::WaitBeforeContinueIfNeed()
else if (mode > 0)
{
printf("\nWait %u secs for continue.\n",mode);
barGoLink bar(mode);
BarGoLink bar(mode);
for(int i = 0; i < mode; ++i)
{
bar.step();

View file

@ -19,17 +19,35 @@
#include <stdio.h>
#include "ProgressBar.h"
#include "Errors.h"
bool barGoLink::m_showOutput = true;
bool BarGoLink::m_showOutput = true;
char const* const barGoLink::empty = " ";
char const* const BarGoLink::empty = " ";
#ifdef _WIN32
char const* const barGoLink::full = "\x3D";
char const* const BarGoLink::full = "\x3D";
#else
char const* const barGoLink::full = "*";
char const* const BarGoLink::full = "*";
#endif
barGoLink::~barGoLink()
BarGoLink::BarGoLink(int row_count)
{
init(row_count);
}
BarGoLink::BarGoLink(uint32 row_count)
{
MANGOS_ASSERT(row_count < (uint32)ACE_INT32_MAX);
init((int)row_count);
}
BarGoLink::BarGoLink(uint64 row_count)
{
MANGOS_ASSERT(row_count < (uint64)ACE_INT32_MAX);
init((int)row_count);
}
BarGoLink::~BarGoLink()
{
if (!m_showOutput)
return;
@ -38,7 +56,7 @@ barGoLink::~barGoLink()
fflush(stdout);
}
barGoLink::barGoLink(int row_count)
void BarGoLink::init(int row_count)
{
rec_no = 0;
rec_pos = 0;
@ -62,7 +80,7 @@ barGoLink::barGoLink(int row_count)
fflush(stdout);
}
void barGoLink::step()
void BarGoLink::step()
{
if (!m_showOutput)
return;
@ -94,7 +112,7 @@ void barGoLink::step()
}
// avoid use inline version because linking problems with private static field
void barGoLink::SetOutputState(bool on)
void BarGoLink::SetOutputState(bool on)
{
m_showOutput = on;
}
}

View file

@ -20,17 +20,21 @@
#include "Platform/Define.h"
class MANGOS_DLL_SPEC barGoLink
class MANGOS_DLL_SPEC BarGoLink
{
public: // constructors
barGoLink(int row_count);
~barGoLink();
explicit BarGoLink(int row_count);
explicit BarGoLink(uint32 row_count); // row_count < ACE_INT32_MAX
explicit BarGoLink(uint64 row_count); // row_count < ACE_INT32_MAX
~BarGoLink();
public: // modifiers
void step( void );
void step();
static void SetOutputState(bool on);
private:
void init(int row_count);
static bool m_showOutput; // not recommended change with existed active bar
static char const * const empty;
static char const * const full;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11589"
#define REVISION_NR "11590"
#endif // __REVISION_NR_H__