Skip to content

Instantly share code, notes, and snippets.

@ochilab
Last active December 18, 2015 18:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ochilab/5829183 to your computer and use it in GitHub Desktop.
Save ochilab/5829183 to your computer and use it in GitHub Desktop.
レポート用紙スキャンシステムのデータクラス
#include "StdAfx.h"
#include "ErrorList.h"
using namespace gazou1;
ErrorItem::ErrorItem()
{
this->file = "" ;
this->page = 0 ;
this->errortype = "" ;
this->bangou = "" ;
this->tokuten = 0 ;
this->zyugyou = "" ;
this->what = "" ;
this->when = DateTime(0) ;
}
ErrorList::ErrorList()
{
this->items = gcnew List<ErrorItem^>;
}
void ErrorList::Clear()
{
this->items->Clear();
}
void ErrorList::Add(System::String ^file, int page, System::String ^errortype , String^ bangou , int tokuten , String^ zyugyou , String^ what , DateTime when )
{
ErrorItem^ item = gcnew ErrorItem( file , page , errortype , bangou , tokuten , zyugyou , what , when );
this->Add( item );
}
void ErrorList::Add( ErrorItem^ item )
{
this->items->Add( item );
}
void ErrorList::Remove(System::String ^file, int page , String^ zyugyou)
{
for each ( ErrorItem^ item in this->items ){
if( item->File->Equals( file ) && item->Page == page && item->Zyugyou->Equals( zyugyou ) ){
Remove( item );
break ;
}
}
}
void ErrorList::Remove( ErrorItem^ item )
{
this->items->Remove( item ) ;
}
List<ErrorItem^>^ ErrorList::Select( String^ file , int page , String^ zyugyou )
{
return nullptr ;
}
ErrorItem::ErrorItem(System::String ^file, int page, System::String ^errortype, String^ bangou , int tokuten , String^ zyugyou , String^ what , DateTime when )
{
this->file = file ;
this->page = page ;
this->errortype = errortype ;
this->bangou = bangou ;
this->tokuten = tokuten ;
this->zyugyou = zyugyou ;
this->what = what ;
this->when = when ;
}
String^ ErrorItem::ToString()
{
return String::Format("{0} {1} {2} {3}",
zyugyou , file , page , errortype );
}
#pragma once
namespace gazou1{
using namespace System;
using namespace System::Collections::Generic;
ref class ErrorItem
{
private:
String^ file ;
int page ;
String^ errortype ;
String^ bangou ;
int tokuten ;
String^ zyugyou ;
String^ what ;
DateTime when ;
public:
ErrorItem();
ErrorItem( String^ file , int page , String^ errortype , String^ bangou , int tokuten , String^ zyugyou , String^ what , DateTime when );
public:
virtual String^ ToString() override;
property String^ File{
String^ get(){ return this->file; }
void set( String^ value ){ this->file = value; }
}
property int Page{
int get(){ return this->page; }
void set( int value ){ this->page = value; }
}
property String^ Errortype{
String^ get(){ return this->errortype; }
void set( String^ value ){ this->errortype = value; }
}
property String^ Bangou{
String^ get(){ return this->bangou; }
void set( String^ value ){ this->bangou = value; }
}
property int Tokuten{
int get(){ return this->tokuten; }
void set( int value ){ this->tokuten = value; }
}
property String^ Zyugyou{
String^ get(){ return this->zyugyou; }
void set( String^ value ){ this->zyugyou = value; }
}
property String^ What{
String^ get(){ return this->what; }
void set( String^ value ){ this->what = value; }
}
property DateTime When{
DateTime get(){ return this->when; }
void set( DateTime value ){ this->when = value; }
}
};
ref class ErrorList
{
private:
List<ErrorItem^>^ items;
public:
ErrorList();
public:
void Clear();
void Add( String^ file , int page , String^ errortype , String^ bangou , int tokuten , String^ zyugyou , String^ what , DateTime when ) ;
void Add( ErrorItem^ item ) ;
void Remove( String^ file , int page , String^ zyugyou );
void Remove( ErrorItem^ item );
List<ErrorItem^>^ Select( String^ file , int page , String^ zyugyou );
property List<ErrorItem^>^ Items {
List<ErrorItem^>^ get() { return this->items; }
}
};
}
#include "StdAfx.h"
#include "ReportList.h"
using namespace gazou1;
ReportItem::ReportItem()
{
this->studentnumber = "" ;
this->result = 0 ;
this->classname = "" ;
this->filename = "" ;
this->pageoffile = 0 ;
this->type = "" ;
this->date = DateTime(0) ;
this->tiffdo = "" ;
}
ReportItem::ReportItem( String^ studentnumber , int result , String^ classname , String^ filename ,int pageoffile , String^ type , DateTime date , String^ tiffdo )
{
this->studentnumber = studentnumber ;
this->result = result ;
this->filename = filename ;
this->classname = classname ;
this->pageoffile = pageoffile ;
this->type = type ;
this->date = date ;
this->tiffdo = tiffdo ;
}
String^ ReportItem::ToString()
{
return String::Format("{0} {1} {2} {3} {4} {5} {6} {7}", studentnumber , result , classname , filename , pageoffile , type , date.ToShortDateString() , tiffdo );
}
ReportList::ReportList()
{
this->items = gcnew List<ReportItem^>;
}
void ReportList::Clear()
{
this->items->Clear();
}
void ReportList::Add( String ^studentnumber , int result , String^ classname , String^ filename , int pageoffile , String^ type , DateTime date , String^ tiffdo )
{
ReportItem^ item = gcnew ReportItem( studentnumber , result , classname , filename , pageoffile , type , date , tiffdo );
this->Add( item );
}
void ReportList::Add( ReportItem^ item )
{
this->items->Add( item );
}
void ReportList::Remove( String^ studentnumber , int result)
{
for each( ReportItem^ item in this->items ){
if( item->Studentnumber->Equals( studentnumber ) && item->Result == result )
{
Remove( item );
break;
}
}
}
void ReportList::Remove( ReportItem^ item )
{
this->items->Remove( item );
}
#pragma once
namespace gazou1{
using namespace System;
using namespace System::Collections::Generic;
ref class ReportItem
{
private:
String^ studentnumber ;
int result ;
String^ classname ;
String^ filename ;
int pageoffile ;
String^ type ;
DateTime date ;
String^ tiffdo ;
public:
ReportItem();
ReportItem( String^ studentnnumber , int result , String^ classname , String^ filename , int pageoffile , String^ type , DateTime date , String^ tiffdo );
public:
virtual String^ ToString() override;
public:
property String^ Studentnumber{
String^ get(){ return this->studentnumber;}
void set( String^ value ){this->studentnumber = value;}
}
property int Result{
int get(){ return this->result; }
void set( int value ){ this->result = value; }
}
property String^ Filename{
String^ get(){ return this->filename;}
void set( String^ value ){ this->filename = value; }
}
property String^ Classname{
String^ get(){ return this->classname;}
void set( String^ value ){ this->classname = value; }
}
property int Pageoffile{
int get(){ return this->pageoffile; }
void set( int value ){ this->pageoffile = value; }
}
property String^ Type{
String^ get(){ return this->type; }
void set( String^ value ){ this->type = value; }
}
property DateTime Date{
DateTime get(){ return this->date; }
void set( DateTime value ){ this->date = value; }
}
property String^ Tiffdo{
String^ get(){ return this->tiffdo;}
void set( String^ value ){this->tiffdo = value;}
}
};
ref class ReportList
{
private:
List<ReportItem^>^ items;
public:
ReportList();
public:
void Clear();
void Add( String^ studentnumber , int result , String^ classname , String^ filename , int pageoffile , String^ type , DateTime date , String^ tiffdo );
void Add( ReportItem^ item );
void Remove( String^ studentnumber, int result );
void Remove( ReportItem^ item );
property List<ReportItem^>^ Items{
List<ReportItem^>^ get(){ return this->items; }
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment