<commit_before>/**
 * <NAME> - 14CS30015
 *
 * Software Engineering Lab - Assignment 3
 * Contains implementation of the DateFormat Class
 *
 */

#include <iostream>
#include <exception>
#include <cstdio>
#include <cstring>
#include <ctime>

#include "date.h"
#include "date_comp.h"

using namespace std;

void formatter_date (const char* dateString, char* dateFormat)
{
    switch (strlen(dateString))
    {
        case 1:
            dateFormat = new char[2];
            strcpy (dateFormat, dateString);
            break;

        case 2:
            dateFormat = new char[2];
            strcpy (dateFormat, dateString);
            break;

        default:
            dateFormat = new char[2];
            strcpy (dateFormat, "0");
    };
}

void formatter_month (const char* dateString, char* dateFormat)
{
    if (strlen(dateString) == 1 || strlen(dateString) == 2)
        strcpy (dateFormat, dateString);
    else
        strcpy (dateFormat, "0");
}

void formatter_year (const char* dateString, char* dateFormat)
{
    if (strlen(dateString) == 1 || strlen(dateString) == 2)
        strcpy (dateFormat, dateString);
    else
        strcpy (dateFormat, "0");
}

// The parameters below takes designated values with the specified format semantics

// dateFormat:
// 0: No date. This is valid for output only.
// "d": single digit date in one digit, double digit date in two digits (7, 23)
// "dd": all dates in two digits with single digit dates with leading 0 (07, 23)
// monthFormat:
// 0: each month in its full name (February, November). This is valid for output only.
// "m": single digit month in one digit, double digit month in two digits (2, 11)
// "mm": all months in two digits with single digit months with leading 0 (02, 11)
// "mmm": each month with first three letters of its name (Feb, Nov). This is valid for output only.
// yearFormat:
// 0: No year. This is valid for output only.
// "yy": year in last two digits (1961 as 61, 2016 as 16)
// "yyyy": year in four digits (1961 as 1961, 2016 as 2016)
DateFormat::DateFormat (const char* dateFormat, const char* monthFormat, const char* yearFormat)
{
    DateFormat::dateFormat = new char[MAX_DATE_LENGTH];
    DateFormat::monthFormat = new char[MAX_MONTH_LENGTH];
    DateFormat::yearFormat = new char[MAX_YEAR_LENGTH];
}

// Single C-string format where dateFormat, monthFormat, and yearFormat are separated by ’-’
// Example: "dd-mmm-yy", "d-mm-yyyy", etc
DateFormat::DateFormat (const char* format)
{

}

/**
 * Default DateFormat created as "dd-mmm-yy"
 * Use current date from system
 */<commit_msg>add string date formatter constructor<commit_after>/**
 * <NAME> - 14CS30015
 *
 * Software Engineering Lab - Assignment 3
 * Contains implementation of the DateFormat Class
 *
 */

#include <iostream>
#include <exception>
#include <cstdio>
#include <cstring>
#include <ctime>

#include "date.h"
#include "date_comp.h"

using namespace std;

// void formatter_date (const char* dateString, char* dateFormat)
// {
//     switch (strlen(dateString))
//     {
//         case 1:
//             dateFormat = new char[2];
//             strcpy (dateFormat, dateString);
//             break;
//
//         case 2:
//             dateFormat = new char[2];
//             strcpy (dateFormat, dateString);
//             break;
//
//         default:
//             dateFormat = new char[2];
//             strcpy (dateFormat, "0");
//     };
// }
//
// void formatter_month (const char* dateString, char* dateFormat)
// {
//     if (strlen(dateString) == 1 || strlen(dateString) == 2)
//         strcpy (dateFormat, dateString);
//     else
//         strcpy (dateFormat, "0");
// }
//
// void formatter_year (const char* dateString, char* dateFormat)
// {
//     if (strlen(dateString) == 1 || strlen(dateString) == 2)
//         strcpy (dateFormat, dateString);
//     else
//         strcpy (dateFormat, "0");
// }

// The parameters below takes designated values with the specified format semantics

// dateFormat:
// 0: No date. This is valid for output only.
// "d": single digit date in one digit, double digit date in two digits (7, 23)
// "dd": all dates in two digits with single digit dates with leading 0 (07, 23)
// monthFormat:
// 0: each month in its full name (February, November). This is valid for output only.
// "m": single digit month in one digit, double digit month in two digits (2, 11)
// "mm": all months in two digits with single digit months with leading 0 (02, 11)
// "mmm": each month with first three letters of its name (Feb, Nov). This is valid for output only.
// yearFormat:
// 0: No year. This is valid for output only.
// "yy": year in last two digits (1961 as 61, 2016 as 16)
// "yyyy": year in four digits (1961 as 1961, 2016 as 2016)
DateFormat::DateFormat (const char* dateFormat, const char* monthFormat, const char* yearFormat)
{

}

// Single C-string format where dateFormat, monthFormat, and yearFormat are separated by ’-’
// Example: "dd-mmm-yy", "d-mm-yyyy", etc
DateFormat::DateFormat (const char* format)
{
    // Take '-' as delimiter to break string
    char* tmp_date = strtok (format,"-");
    char* tmp_month = strtok (NULL,"-");
    char* tmp_year = strtok (NULL,"-");


}

/**
 * Default DateFormat created as "dd-mmm-yy"
 * Use current date from system
 */
{'fraction_non_alphanumeric': 0.12965412965412965, 'fraction_numerical': 0.025326025326025327, 'mean_word_length': 2.859956236323851, 'pattern_counts': {'":': 14, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '54876', 'n_tokens_mistral': 1719, 'n_tokens_neox': 1587, 'n_words': 611}