コード例 #1
0
ファイル: list_remove_if.cpp プロジェクト: Fredi/Cpp
    bool operator()(Person const person) const
    {
        // Remove people with name length < 4
        std::string name = person.GetName();
        if (name.length() < 4)
            return true;

        // Remove people with less then 18 years old
        if (person.GetAge() < 18)
            return true;

        return false;
    }
コード例 #2
0
bool ModelValidator::isValid(const Person& patient, bool allowDefaults/* = false*/)
{
	RETURN_IF_STR_EMPTY(patient.GetName(), "Patient Name");
//	RETURN_IF_STR_EMPTY(patient.GetPatientID(), "Patient ID");

	if (allowDefaults)
	{
		RETURN_IF_NOT_VALID1(patient.GetBirthDate(), true, "Patient Birth Date");
	}
	else
	{
		RETURN_IF_NOT_VALID1(patient.GetBirthDate(), false, "Patient Birth Date");
		RETURN_IF_STR_EMPTY(patient.GetSex(), "Sex");
	}

	return true;
}