Magnum / source / libs / magnum_net / source / magnum / net / MediaType.h

/*
  Magnum 
  Copyright (C) 2002-2012 Kaya Kupferschmidt. All Rights Reserved.

  This software is provided 'as-is', without any express or implied
  warranty.  In no event will the authors be held liable for any damages
  arising from the use of this software.

  Permission is granted to anyone to use this software for any purpose,
  including commercial applications, and to alter it and redistribute it
  freely, under the terms in LICENSE.TXT.

  Kaya Kupferschmidt  (k.kupferschmidt@dimajix.de)
*/

#ifndef __MAGNUM_NET_MEDIATYPE_H
#define __MAGNUM_NET_MEDIATYPE_H

#include "magnum/object/CString.h"
#include "magnum/object/String.h"
#include "magnum/net/DllExport.h"


namespace magnum { namespace net {
using magnum::types::String;
using magnum::types::CString;


/*--------------------------------------------------------------------------*/
/**
 */
class MAGNUM_NET_API MediaType {
STRUCT_METAINFO(MediaType);
public:
    MediaType();
    explicit MediaType(const CString& type);
    MediaType(const CString& type, const CString& subtype);
    
    inline void setType(const CString& type)
    {
        m_Type = type;
    }
    inline const CString& getType() const
    {
        return m_Type;
    }
    inline void setSubtype(const CString& type)
    {
        m_Subtype = type;
    }
    inline const CString& getSubtype() const
    {
        return m_Subtype;
    }
    
    bool isEmpty() const;
    bool isValid() const;
    
    String toString() const;
    CString toCString() const;

private:
    CString m_Type;
    CString m_Subtype;
};

} }

#endif
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.