progress.cc #1

  • //
  • guest/
  • perforce_software/
  • p4/
  • 2014-2/
  • support/
  • progress.cc
  • View
  • Commits
  • Open Download .zip Download (1 KB)
/*
 * Copyright 1995, 2011 Perforce Software.  All rights reserved.
 *
 * This file is part of Perforce - the FAST SCM System.
 */

# include <stdhdrs.h>
# include <strbuf.h>
# include <timer.h>
# include <progress.h>

ProgressReport::ProgressReport()
{
	fieldChanged = CP_NEW;
	units = 0;
	total = -1;
	position = 0;
	lastReportedPosition = 0;
	needfinal = 0;
	tm.Start();
}

ProgressReport::~ProgressReport()
{
	if( needfinal )
	    DoReport( CPP_FAILDONE );
}

void
ProgressReport::Description( const StrPtr &d )
{
	description = d;
	fieldChanged |= CP_DESC;
}

void
ProgressReport::Units( int u )
{
	units = u;
	fieldChanged |= CP_UNITS;
}

void
ProgressReport::Total( long t )
{
	total = t;
	fieldChanged |= CP_TOTAL;
}

void
ProgressReport::Position( long p, int flag )
{
	if( p != position )
	{
	    position = p;
	    fieldChanged |= CP_POS;
	}
	ConsiderReport( flag );
}

void
ProgressReport::Increment( long p, int flag )
{
	if( p != 0 )
	{
	    position += p;
	    fieldChanged |= CP_POS;
	}
	ConsiderReport( flag );
}

void
ProgressReport::ConsiderReport( int flag )
{
	if( flag == CPP_NORMAL )
	{
	    int tim = tm.Time();
	    if( tim < 500 )
		return;
	    tm.Restart();
	}
	DoReport( flag );
}

void
ProgressReport::DoReport( int flag )
{
}
# Change User Description Committed
#1 15903 Matt Attaway Everything should be happy now between the Workshop and the depot paths
//guest/perforce_software/p4/2014_2/support/progress.cc
#1 15901 Matt Attaway Clean up code to fit modern Workshop naming standards
//guest/perforce_software/p4/2014.2/support/progress.cc
#1 12189 Matt Attaway Initial (and much belated) drop of 2014.2 p4 source code