//
// Copyright (c) 2014 Secret Geometry, Inc.  All rights reserved.
//

#ifndef TERMKIT_TUPLE_H
#define TERMKIT_TUPLE_H

#ifdef __cplusplus
    #include <ostream>
#endif

//
// Simple pair for describing locations in 2d data structures.
//

typedef struct LongTuple
{
    int x, y;
    
    #ifdef __cplusplus
        
        LongTuple() : x(0), y(0) {}
        
        LongTuple(int i, int j) : x(i), y(j) {}
        
        bool operator==(const LongTuple& other) const
        {
            return x == other.x && y == other.y;
        }
        
        bool operator!=(const LongTuple& other) const
        {
            return x != other.x || y != other.y;
        }
    
        friend std::ostream& operator<<(std::ostream& stream, const LongTuple& loc)
        {
            stream << "(" << loc.x << ", " << loc.y << ")";
            return stream;
        }
        
    #endif
    
} LongTuple;

typedef LongTuple GridSize;
typedef LongTuple GridLocation;
typedef LongTuple LineLocation;

#endif
