nsContentTypeParser.cpp (959B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #include "nsContentTypeParser.h" 8 9 #include "nsContentUtils.h" 10 #include "nsNetUtil.h" 11 12 using namespace mozilla; 13 14 nsContentTypeParser::nsContentTypeParser(const nsAString& aString) 15 : mString(aString) {} 16 17 nsresult nsContentTypeParser::GetParameter(const char* aParameterName, 18 nsAString& aResult) const { 19 return net::GetParameterHTTP(mString, aParameterName, aResult); 20 } 21 22 nsresult nsContentTypeParser::GetType(nsAString& aResult) const { 23 nsresult rv = GetParameter(nullptr, aResult); 24 if (NS_FAILED(rv)) { 25 return rv; 26 } 27 nsContentUtils::ASCIIToLower(aResult); 28 return NS_OK; 29 }