/// Copyright (c) 2009 Ruben Penalva. All rights reserved.
/// Redistribution and use in source and binary forms, with or without modification, 
/// are permitted provided that the following conditions are met:
///    1. Redistributions of source code must retain the above copyright notice, this 
///    list of conditions and the following disclaimer.
///    2. Redistributions in binary form must reproduce the above copyright notice,
///    this list of conditions and the following disclaimer in the documentation and/or
///    other materials provided with the distribution.
///    3. The name of the author may not be used to endorse or promote products derived
///    from this software without specific prior written permission.
///
/// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
/// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
/// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 
/// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 
/// TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
/// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 
/// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

/// @file LetterCDTTestLogic.h
/// This source file is part of 2dRender LetterCDT Test.
/// The file holds the LetterCDTTestLogic class interface.
/// @author Ruben Penalva (ruben.penalva@rpenalva.com)

#ifndef _LETTER_CDT_TEST_LOGIC_H_
#define _LETTER_CDT_TEST_LOGIC_H_

#include "Point.h"
#include "Line.h"

#include "GlyphOutlineLoader.h"

#include <vector>

namespace LetterCDT
{

/// @brief It handles all the logic of the test. Its called by Runner, 
/// which act as a controller between Logic and Render. It contains
/// the points, segments and lines of the letters queried.
class LetterCDTTestLogic
{
public:
	/// Constructor
	LetterCDTTestLogic(void);

	/// Destructor
	~LetterCDTTestLogic(void);

	/// @brief Inserts a letter in the test string
	/// @param charCode code of the character being inserted
	void PushLetter(wchar_t charCode);

	/// @brief Clears the test string.
	void Reset(void);

	/// @brief Enable/Disable points showing
	/// @note Probably this is not the best site for
	/// this method
	void EnablePoints(void);

	/// @brief Enable/Disable segments showing
	/// @note Probably this is not the best site for
	/// this method
	void EnableSegments(void);

	/// @brief Enable/Disable triangles showing
	/// @note Probably this is not the best site for
	/// this method
	void EnableTriangles(void);

	/// @brief Check if showing points is enable.
	/// @return true if points are enable, false otherwise
	bool ArePointsEnabled(void);

	/// @brief Check if showing segments is enable.
	/// @return true if segments are enable, false otherwise
	bool AreSegmentsEnabled(void);

	/// @brief Check if showing triangles is enable.
	/// @return true if triangles are enable, false otherwise
	bool AreTrianglesEnabled(void);

	/// @brief Get string points
	/// @return test string points
	const std::vector<Point>& GetPoints(void) const;

	/// @brief Get string lines
	/// @return test string lines
	const std::vector<Line>& GetLines(void) const;

	/// @brief Get string triangles
	/// @return test string triangles
	const std::vector<int>& GetTriangles(void) const;
	
private:
	/// Glyph outline loader
	GlyphOutlineLoader m_glyphOutlineLoader;

	/// Are points enabled?
	bool m_enabledPoints;

	/// Are segments enabled?
	bool m_enabledSegments;

	/// Are triangles enabled?
	bool m_enabledTriangles;

	/// Test string points
	std::vector<Point> m_points;

	/// Test string lines
	std::vector<Line> m_lines;

	/// Test string triangles
	std::vector<int> m_triangles;

	/// Translations for every character in test string
	std::vector<float> m_translations;

	/// @note hide copy constructor from interface user
	LetterCDTTestLogic(const LetterCDTTestLogic&);

	/// @note hide assignment operator from interface user
	LetterCDTTestLogic& operator=(const LetterCDTTestLogic&);
};

}

#endif