4267a229创建于 2024年8月2日历史提交
/*
    Copyright (c) [2023] [squallzhao]
    fountain is licensed under APACHE LICENSE, VERSION 2.0.
    You can use this software according to the terms and conditions of the APACHE LICENSE, VERSION 2.0.
    You may obtain a copy of APACHE LICENSE, VERSION 2.0 at: https://www.apache.org/licenses/LICENSE-2.0
*/
package microservice.web.http11

import std.collection.*
public class Cookies {
    var map = HashMap<String, Cookie>()
    
    public func parse(data:String): Bool{
        var arr = data.split(';')
        for(item in arr){
            var kv = item.split('=')
            if (kv.size==2){
                map.put(kv[0],Cookie(kv[0],kv[1]))
            } else{
                return false
            }
        }
        return true
    }
    
    public func getSize():Int64{
        return map.size
    }

    public func getMap():HashMap<String, Cookie>{
        return map
    }
}